We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 89afa05 + 59924d4 commit 05d1d65Copy full SHA for 05d1d65
MD/HashMap.md
@@ -42,9 +42,15 @@ Iterator<String> iterator = map.keySet().iterator();
42
}
43
```
44
45
+```java
46
+map.forEach((key,value)->{
47
+ System.out.println("key=" + key + " value=" + value);
48
+});
49
+```
50
+
51
**强烈建议**使用第一种 EntrySet 进行遍历。
52
-第一种可以把 key value 同时取出,第二种还得需要通过 key 取一次 value,效率较低。
53
+第一种可以把 key value 同时取出,第二种还得需要通过 key 取一次 value,效率较低, 第三种需要JDK1.8以上,通过外层遍历table,内层遍历链表或红黑树。
54
55
56
## notice
0 commit comments