mirror of
https://github.com/chefyuan/algorithm-base.git
synced 2025-08-02 05:51:34 +00:00
chefyuan
This commit is contained in:
@@ -229,7 +229,7 @@ HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
|
||||
|
||||
往hashmap里面插入数据
|
||||
|
||||
```
|
||||
```java
|
||||
for (int num : arr){
|
||||
map.put(num, map.getOrDefault(num, 0) + 1);//如果没有则添加,如果有则加1
|
||||
}
|
||||
|
Reference in New Issue
Block a user