Skip to content

Commit 2a5929b

Browse files
author
Todd Mahoney
committed
removing public access modifiers from custom-set reference
1 parent 727bb7e commit 2a5929b

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

‎exercises/custom-set/.meta/src/reference/java/CustomSet.java‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,32 @@
66
import java.util.function.Predicate;
77
import java.util.stream.Collectors;
88

9-
public class CustomSet<T> {
9+
class CustomSet<T> {
1010

1111
private Set<T> set;
1212

13-
public CustomSet() {
13+
CustomSet() {
1414
this(Collections.emptyList());
1515
}
1616

17-
public CustomSet(Collection<T> data) {
17+
CustomSet(Collection<T> data) {
1818
set = new HashSet<>(data.size());
1919
this.set.addAll(data);
2020
}
2121

22-
public boolean isEmpty() {
22+
boolean isEmpty() {
2323
return set.isEmpty();
2424
}
2525

26-
public boolean contains(T element) {
26+
boolean contains(T element) {
2727
return set.contains(element);
2828
}
2929

30-
public boolean isSubset(CustomSet<T> anotherSet) {
30+
boolean isSubset(CustomSet<T> anotherSet) {
3131
return set.containsAll(anotherSet.set);
3232
}
3333

34-
public boolean isDisjoint(CustomSet<T> anotherSet) {
34+
boolean isDisjoint(CustomSet<T> anotherSet) {
3535
if (set.isEmpty() || anotherSet.set.isEmpty()) {
3636
return true;
3737
}
@@ -40,29 +40,29 @@ public boolean isDisjoint(CustomSet<T> anotherSet) {
4040
.count() == 0;
4141
}
4242

43-
public boolean equals(CustomSet<T> anotherSet) {
43+
boolean equals(CustomSet<T> anotherSet) {
4444
return set.equals(anotherSet.set);
4545
}
4646

47-
public boolean add(T element) {
47+
boolean add(T element) {
4848
return set.add(element);
4949
}
5050

51-
public CustomSet<T> getIntersection(CustomSet<T> anotherSet) {
51+
CustomSet<T> getIntersection(CustomSet<T> anotherSet) {
5252
return new CustomSet<>(
5353
set.stream()
5454
.filter(anotherSet.set::contains)
5555
.collect(Collectors.toList())
5656
);
5757
}
5858

59-
public CustomSet<T> getUnion(CustomSet<T> anotherSet) {
59+
CustomSet<T> getUnion(CustomSet<T> anotherSet) {
6060
final Set<T> union = new HashSet<>(set);
6161
union.addAll(anotherSet.set);
6262
return new CustomSet<>(union);
6363
}
6464

65-
public CustomSet<T> getDifference(CustomSet<T> anotherSet) {
65+
CustomSet<T> getDifference(CustomSet<T> anotherSet) {
6666
final Predicate<T> predicate = anotherSet::contains;
6767
return new CustomSet<>(
6868
set.stream()

0 commit comments

Comments
 (0)