Skip to content

Commit 223dd32

Browse files
Add files via upload
1 parent cc87dc5 commit 223dd32

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

ConcurrentHashMapKSV1.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import java.util.concurrent.ConcurrentHashMap;
2+
3+
4+
public class ConcurrentHashMapKSV1 {
5+
6+
public static void main(String[] args){
7+
8+
9+
ConcurrentHashMap<Integer, String> map = new ConcurrentHashMap<>();
10+
map.put(1, "one");
11+
map.put(2, "two");
12+
map.put(3, "three");
13+
map.put(4, "four");
14+
15+
ConcurrentHashMap.KeySetView<Integer, String> keySetView = map.keySet();
16+
17+
System.out.println(keySetView);
18+
19+
}
20+
21+
}

ConcurrentHashMapKSV2.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import java.util.concurrent.ConcurrentHashMap.KeySetView;
2+
import java.util.concurrent.ConcurrentHashMap;
3+
4+
public class ConcurrentHashMapKSV2 {
5+
6+
public static void main(String[] args){
7+
8+
9+
ConcurrentHashMap<Integer, String> map = new ConcurrentHashMap<>();
10+
map.put(1, "one");
11+
map.put(2, "two");
12+
map.put(3, "three");
13+
map.put(4, "four");
14+
15+
KeySetView<Integer, String> keySetView = map.keySet();
16+
17+
System.out.println(keySetView);}
18+
19+
}

0 commit comments

Comments
 (0)