-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestSet1.java
More file actions
28 lines (27 loc) · 856 Bytes
/
TestSet1.java
File metadata and controls
28 lines (27 loc) · 856 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
import java.util.HashSet;
class TestSet1{
public static void main(String[] args) {
HashSet set = new HashSet();
set.add(1);
set.add("2");
set.add(3.0);
set.add(false);
set.add("2");
set.add("four");
for(Object tmp: set){
System.out.println(tmp);
}
System.out.println("===================");
System.out.println(set);
System.out.println("¦³ " + set.size() + "Ó");
System.out.println("is set empty ? " + set.isEmpty());
System.out.println("is 3.0 inside ? " + set.contains(3.0));
System.out.println("delete 3.0 " + set.remove(3.0));
System.out.println(set);
System.out.println("clear set");
set.clear();
System.out.println(set);
System.out.println("¦³ " + set.size() + "Ó");
System.out.println("is set empty ? " + set.isEmpty());
}
}