-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapDemo.java
More file actions
26 lines (21 loc) · 642 Bytes
/
MapDemo.java
File metadata and controls
26 lines (21 loc) · 642 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
package Codes;
import java.util.ArrayList;
import java.util.HashMap;
public class MapDemo {
public static void main(String[] args) {
HashMap<String, ArrayList<Integer>> phoneMap = new HashMap<>();
ArrayList<Integer> phoneList = new ArrayList<>();
phoneList.add(2222);
phoneList.add(3333);
phoneList.add(3333);
phoneMap.put("ram", phoneList);
ArrayList<Integer> phoneList2 = new ArrayList<>();
phoneList2.add(42222);
phoneList2.add(23333);
phoneMap.put("shyam", phoneList2);
// phoneMap.put("ram", 66666);
// System.out.println(phoneMap);
System.out.println(phoneMap.get("ram"));
phoneMap.remove("ram");
}
}