-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDemo1.java
More file actions
38 lines (28 loc) · 800 Bytes
/
Demo1.java
File metadata and controls
38 lines (28 loc) · 800 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
35
36
37
38
import java.util.ArrayList;
import java.util.HashMap;
import java.util.TreeSet;
public class Demo1 {
public static void main(String[] args) {
// 1. No Duplicate
// 2. Sorted
TreeSet<String> songs = new TreeSet<String>();
songs.add("I got the Power");
songs.add("It's My Life");
songs.add("Boom Boom");
songs.add("It's My Life");
songs.add("Boom Boom");
songs.add("I got the Power");
/*songs.add(100);
songs.add(90.20);
songs.add(true);*/
System.out.println(songs);
HashMap<String,ArrayList<Integer>> map = new HashMap<>();
ArrayList<Integer> phonelist = new ArrayList<>();
phonelist.add(2222);
phonelist.add(3222);
phonelist.add(4222);
map.put("amit",phonelist);
//map.put("ram",3333);
System.out.println(map.get("amit").get(0));
}
}