-
Notifications
You must be signed in to change notification settings - Fork 0
/
HashMapExample.java
31 lines (26 loc) · 940 Bytes
/
HashMapExample.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
package com.stech.collections;
import java.util.HashMap;
/**
* Created by sandeeplulla
*/
public class HashMapExample {
public static void main(String[] args) {
HashMap map = new HashMap();
System.out.println(map.put(1, "Sandeep"));
System.out.println(map.put(2, "Ravi"));
System.out.println(map.put(3, "Suraj"));
System.out.println(map.put(1, "Surya"));
HashMap hashMap = new HashMap();
hashMap.put(1, "Sandeep");
hashMap.put(2, "Ravi");
hashMap.put(3, "Suraj");
hashMap.put(1, "Surya");
System.out.println(hashMap.get(1));
System.out.println(hashMap.keySet());
System.out.println(hashMap.containsKey(3));
System.out.println(hashMap.containsValue(4));
System.out.println(hashMap.put(null, null));
System.out.println(hashMap.size());
System.out.println(hashMap.entrySet().getClass());
}
}