-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetPractice.java
More file actions
27 lines (21 loc) · 809 Bytes
/
SetPractice.java
File metadata and controls
27 lines (21 loc) · 809 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
import java.util.*;
public class SetPractice {
public static void main(String[] args) {
List<Character> characterList = new ArrayList<>();
characterList.add('A');
characterList.add('B');
characterList.add('D');
characterList.add('A');
characterList.add('C');
characterList.add('Z');
characterList.add('F');
characterList.add('C');
System.out.println(characterList);
Set<Character> treeSet = new TreeSet<>(characterList);
System.out.println(treeSet);
Set<Character> linkedHashSet = new LinkedHashSet<>(characterList);
System.out.println(linkedHashSet);
Set<Character> hashSet = new HashSet<>(characterList);
System.out.println(hashSet);
}
}