Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Glavo committed Nov 5, 2024
1 parent 672dfd6 commit 1a5f603
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import kala.collection.base.Iterators;
import kala.annotations.Covariant;
import kala.collection.immutable.ImmutableSet;
import kala.collection.mutable.MutableHashSet;
import org.jetbrains.annotations.NotNull;

import java.util.Iterator;
Expand Down Expand Up @@ -51,7 +50,7 @@ public Added(@NotNull SetLike<E> source, E addedValue) {

@Override
public boolean contains(Object value) {
return Objects.equals(this.addedValue, value) || source.contains(value);
return Objects.equals(addedValue, value) || source.contains(value);
}

@Override
Expand All @@ -60,10 +59,7 @@ public boolean contains(Object value) {
return this;
}

var addedValues = new MutableHashSet<E>();
addedValues.add(this.addedValue);
addedValues.add(value);

var addedValues = ImmutableSet.of(value, addedValue);
Conditions.assertEquals(2, addedValues.size());
return new AddedAll<>(this, addedValues.toImmutableSet());
}
Expand Down

0 comments on commit 1a5f603

Please sign in to comment.