Skip to content

Commit 97c83c4

Browse files
Add files via upload
1 parent d98ae75 commit 97c83c4

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

ConcurrentHashMapMethods7.java

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import java.util.concurrent.ConcurrentHashMap;
2+
public class ConcurrentHashMapMethods7 {
3+
4+
public static void main(String[] args) throws Exception {
5+
// forEach​(long parallelismThreshold, BiConsumer<? super K,​? super V> action)
6+
ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>();
7+
map.put("one", "1");
8+
map.put("two", "2");
9+
map.put("three", "3");
10+
map.put("four", "4");
11+
System.out.println("Map:" + map);
12+
13+
14+
map.forEach(2, (String k, String v) -> {
15+
System.out.println("Key:" + k + " Value:" + v);
16+
17+
});
18+
19+
}
20+
21+
}

0 commit comments

Comments
 (0)