소스 검색

removing public access modifiers from custom-set reference

Todd Mahoney 8 년 전
부모
커밋
2a5929b86c
1개의 변경된 파일12개의 추가작업 그리고 12개의 파일을 삭제
  1. 12
    12
      exercises/custom-set/.meta/src/reference/java/CustomSet.java

+ 12
- 12
exercises/custom-set/.meta/src/reference/java/CustomSet.java 파일 보기

6
 import java.util.function.Predicate;
6
 import java.util.function.Predicate;
7
 import java.util.stream.Collectors;
7
 import java.util.stream.Collectors;
8
 
8
 
9
-public class CustomSet<T> {
9
+class CustomSet<T> {
10
 
10
 
11
     private Set<T> set;
11
     private Set<T> set;
12
 
12
 
13
-    public CustomSet() {
13
+    CustomSet() {
14
         this(Collections.emptyList());
14
         this(Collections.emptyList());
15
     }
15
     }
16
 
16
 
17
-    public CustomSet(Collection<T> data) {
17
+    CustomSet(Collection<T> data) {
18
         set = new HashSet<>(data.size());
18
         set = new HashSet<>(data.size());
19
         this.set.addAll(data);
19
         this.set.addAll(data);
20
     }
20
     }
21
 
21
 
22
-    public boolean isEmpty() {
22
+    boolean isEmpty() {
23
         return set.isEmpty();
23
         return set.isEmpty();
24
     }
24
     }
25
 
25
 
26
-    public boolean contains(T element) {
26
+    boolean contains(T element) {
27
         return set.contains(element);
27
         return set.contains(element);
28
     }
28
     }
29
 
29
 
30
-    public boolean isSubset(CustomSet<T> anotherSet) {
30
+    boolean isSubset(CustomSet<T> anotherSet) {
31
         return set.containsAll(anotherSet.set);
31
         return set.containsAll(anotherSet.set);
32
     }
32
     }
33
 
33
 
34
-    public boolean isDisjoint(CustomSet<T> anotherSet) {
34
+    boolean isDisjoint(CustomSet<T> anotherSet) {
35
         if (set.isEmpty() || anotherSet.set.isEmpty()) {
35
         if (set.isEmpty() || anotherSet.set.isEmpty()) {
36
             return true;
36
             return true;
37
         }
37
         }
40
                 .count() == 0;
40
                 .count() == 0;
41
     }
41
     }
42
 
42
 
43
-    public boolean equals(CustomSet<T> anotherSet) {
43
+    boolean equals(CustomSet<T> anotherSet) {
44
         return set.equals(anotherSet.set);
44
         return set.equals(anotherSet.set);
45
     }
45
     }
46
 
46
 
47
-    public boolean add(T element) {
47
+    boolean add(T element) {
48
         return set.add(element);
48
         return set.add(element);
49
     }
49
     }
50
 
50
 
51
-    public CustomSet<T> getIntersection(CustomSet<T> anotherSet) {
51
+    CustomSet<T> getIntersection(CustomSet<T> anotherSet) {
52
         return new CustomSet<>(
52
         return new CustomSet<>(
53
                 set.stream()
53
                 set.stream()
54
                         .filter(anotherSet.set::contains)
54
                         .filter(anotherSet.set::contains)
56
         );
56
         );
57
     }
57
     }
58
 
58
 
59
-    public CustomSet<T> getUnion(CustomSet<T> anotherSet) {
59
+    CustomSet<T> getUnion(CustomSet<T> anotherSet) {
60
         final Set<T> union = new HashSet<>(set);
60
         final Set<T> union = new HashSet<>(set);
61
         union.addAll(anotherSet.set);
61
         union.addAll(anotherSet.set);
62
         return new CustomSet<>(union);
62
         return new CustomSet<>(union);
63
     }
63
     }
64
 
64
 
65
-    public CustomSet<T> getDifference(CustomSet<T> anotherSet) {
65
+    CustomSet<T> getDifference(CustomSet<T> anotherSet) {
66
         final Predicate<T> predicate = anotherSet::contains;
66
         final Predicate<T> predicate = anotherSet::contains;
67
         return new CustomSet<>(
67
         return new CustomSet<>(
68
                 set.stream()
68
                 set.stream()