Skip to content

Commit 8f79acf

Browse files
committed
Restructure
1 parent 8e9f739 commit 8f79acf

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import java.util.*;
2+
3+
public class Exp9_6 {
4+
public static void main(String[] args) {
5+
6+
7+
HashMap<Integer, String> hash_map = new HashMap<Integer, String>();
8+
9+
10+
hash_map.put(10, "Element at 10");
11+
hash_map.put(11, "Element at 11");
12+
hash_map.put(19, "Element at 19");
13+
hash_map.put(15, "Element at 15");
14+
hash_map.put(3, "Element at 3");
15+
16+
17+
System.out.println("Mapped " + hash_map);
18+
19+
// Checking for the key_element '20'
20+
System.out.println("Element at position '2' : " + hash_map.containsKey(2));
21+
System.out.println("'Element at 10' Present : " + hash_map.containsValue("Element at 10"));
22+
Set<Integer> keys = hash_map.keySet();
23+
System.out.println("Key :");
24+
for (Integer key : keys) {
25+
System.out.println(key);
26+
}
27+
}
28+
29+
}

0 commit comments

Comments
 (0)