File tree 2 files changed +5
-11
lines changed
main/java/com/thealgorithms/datastructures/crdt
test/java/com/thealgorithms/datastructures/crdt
2 files changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ public boolean lookup(T e) {
50
50
* @return true if the current G-Set is a subset of the other, false otherwise
51
51
*/
52
52
public boolean compare (GSet <T > other ) {
53
- return elements .containsAll (other . elements );
53
+ return other . elements .containsAll (elements );
54
54
}
55
55
56
56
/**
Original file line number Diff line number Diff line change @@ -32,20 +32,14 @@ void testLookup() {
32
32
void testCompare () {
33
33
GSet <String > gSet1 = new GSet <>();
34
34
GSet <String > gSet2 = new GSet <>();
35
-
36
35
gSet1 .addElement ("apple" );
37
36
gSet1 .addElement ("orange" );
38
-
39
37
gSet2 .addElement ("orange" );
40
- gSet2 .addElement ("banana" );
41
-
42
38
assertFalse (gSet1 .compare (gSet2 ));
43
-
44
- GSet <String > gSet3 = new GSet <>();
45
- gSet3 .addElement ("apple" );
46
- gSet3 .addElement ("orange" );
47
-
48
- assertTrue (gSet1 .compare (gSet3 ));
39
+ gSet2 .addElement ("apple" );
40
+ assertTrue (gSet1 .compare (gSet2 ));
41
+ gSet2 .addElement ("banana" );
42
+ assertTrue (gSet1 .compare (gSet2 ));
49
43
}
50
44
51
45
@ Test
You can’t perform that action at this time.
0 commit comments