This commit is contained in:
chefyuan
2021-04-24 15:37:24 +08:00
parent 64a63df5ca
commit de5ba98dab
2 changed files with 21 additions and 21 deletions

View File

@@ -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
}