-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHashSetTest.java
More file actions
35 lines (26 loc) · 684 Bytes
/
HashSetTest.java
File metadata and controls
35 lines (26 loc) · 684 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
package Base;
import java.util.HashSet;
import java.util.Set;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeSet;
public class HashSetTest {
public static void main(String[] args) {
String str="gghgaifuerbbaaccddffee";
char[] in = str.toCharArray();
Set set=new HashSet<Character>();
HashSet<Character> hashSet=new HashSet<Character>();
SortedSet<Character> sortedSet=new TreeSet();
//SortedMap<, >
for(int i=0;i<in.length;i++){
set.add(in[i]);
hashSet.add(in[i]);
sortedSet.add(in[i]);
switch(in[i]){
}
}
System.out.println(set);
System.out.println(hashSet);
System.out.println(sortedSet);
}
}