forked from vabburi82/Java8Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHashMapDemo.java
More file actions
34 lines (30 loc) · 969 Bytes
/
Copy pathHashMapDemo.java
File metadata and controls
34 lines (30 loc) · 969 Bytes
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
import java.util.*;
public class HashMapDemo {
@SuppressWarnings({ "rawtypes", "unchecked" })
public static void main(String[] args) {
// TODO Auto-generated method stub
LinkedHashMap m=new LinkedHashMap();
m.put("chandra",101);
m.put("Anil",302);
m.put("venu",203);
m.put("Dhana",402);
System.out.println(m);
/*System.out.println(m.put("venu",800));
Set s=m.keySet();
System.out.println(s);
Collection c= m.values();
System.out.println(c);
Set s1=m.entrySet();
System.out.println(s1);
Iterator itr= s1.iterator();
while(itr.hasNext()){
Map.Entry m1=(Map.Entry)itr.next();
System.out.println(m1.getKey()+"----"+m1.getValue());
if(m1.getKey().equals("Dhana")){
m1.setValue(2000);
}
// System.out.println(m);
}
System.out.println(m);*/
}
}