-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaGenMUB12.java
More file actions
33 lines (27 loc) · 830 Bytes
/
JavaGenMUB12.java
File metadata and controls
33 lines (27 loc) · 830 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
import java.util.HashSet;
import java.util.Set;
public class JavaGenMUB12<T extends HashSet<String> & Set<String>> {
T set;
public JavaGenMUB12(T set) {
this.set = set;
}
public void add(String string) {
set.add(string);
}
public boolean contains(String string) {
return set.contains(string);
}
public static void main(String[] args) {
HashSet<String> set = new HashSet<>();
set.add("one");
set.add("two");
set.add("three");
set.add("four");
set.add("five");
JavaGenMUB12<HashSet<String>> obj = new JavaGenMUB12<>(set);
System.out.println(obj.set);
obj.add("six");
System.out.println(obj.set);
System.out.println(obj.contains("six"));
}
}