- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinekedHAshMapExample.java
More file actions
Latest commit
26 lines (22 loc) · 659 Bytes
/
Copy pathLinekedHAshMapExample.java
File metadata and controls
26 lines (22 loc) · 659 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
packagecollection.Map;
importjava.util.LinkedHashMap;
importjava.util.Map;
publicclassLinekedHAshMapExample {
publicstaticvoidmain(String[] args) {
Map<String,Integer> m=newLinkedHashMap<>();
m.put("six", 6);
m.put("one", 1);
m.put("two", 2);
m.put("seven", 7);
System.out.print("Value Associated with key 'two'= "+m.get("two")+"\n");
System.out.print("Keysets: "+m.keySet()+"\n");
System.out.print("Entry of map: "+m.entrySet()+"\n");
System.out.println("Size of map: "+m.size());
if(m.containsKey("one")) {
Integerx=m.get("one");
System.out.println("one : "+x);
}
if(!m.isEmpty())
System.out.println(m);
}
}