-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHashing.java
50 lines (32 loc) · 1.06 KB
/
Hashing.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.util.*;
public class Hashing {
public static void main(String[] args) {
// HashSet<Integer>set=new HashSet<>();
// set.add(6);
// set.add(5);
// set.add(7);
// System.out.println(set.contains(8));
// set.remove(5);
// System.out.println(set.size());
// System.out.println(set);
// //iterartor
// Iterator it=set.iterator();
// while(it.hasNext()){
// System.out.print(it.next() + " ");
// }
HashMap<String,Integer>map=new HashMap<>();
map.put("India", 90);
map.put("USA",80);
System.out.println(map);
if(map.containsKey("India")){
System.out.println("key is prresent");
}else{
System.out.println("key is not present");
}
System.out.println(map.get("India"));
for(Map.Entry<String,Integer> e:map.entrySet()){
System.out.println(e.getKey());
System.out.println(e.getValue());
}
}
}