File tree Expand file tree Collapse file tree 2 files changed +5
-11
lines changed
main/java/com/thealgorithms/datastructures/crdt
test/java/com/thealgorithms/datastructures/crdt Expand file tree Collapse file tree 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) {
5050 * @return true if the current G-Set is a subset of the other, false otherwise
5151 */
5252 public boolean compare (GSet <T > other ) {
53- return elements .containsAll (other . elements );
53+ return other . elements .containsAll (elements );
5454 }
5555
5656 /**
Original file line number Diff line number Diff line change @@ -32,20 +32,14 @@ void testLookup() {
3232 void testCompare () {
3333 GSet <String > gSet1 = new GSet <>();
3434 GSet <String > gSet2 = new GSet <>();
35-
3635 gSet1 .addElement ("apple" );
3736 gSet1 .addElement ("orange" );
38-
3937 gSet2 .addElement ("orange" );
40- gSet2 .addElement ("banana" );
41-
4238 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 ));
4943 }
5044
5145 @ Test
You can’t perform that action at this time.
0 commit comments