Skip to content

Commit

Permalink
fix: Fix arc collection wrappers messing up the internal iterators of…
Browse files Browse the repository at this point in the history
… their wrapped collection
  • Loading branch information
phinner committed Oct 18, 2023
1 parent f321499 commit 1506167
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 43 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ plugins {
id("distributor.parent-conventions")
}

version = "3.2.0" + if (indraGit.headTag() == null) "-SNAPSHOT" else ""
version = "3.2.1" + if (indraGit.headTag() == null) "-SNAPSHOT" else ""
group = "fr.xpdustry"
description = "The Mindustry plugin of ur dreams..."
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@
import java.io.Serializable;
import java.util.AbstractList;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.RandomAccess;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.function.UnaryOperator;

/**
Expand All @@ -51,22 +48,6 @@ public void replaceAll(final UnaryOperator<E> operator) {
this.seq.replace(operator::apply);
}

@Override
public void sort(final Comparator<? super E> c) {
this.seq.sort(c);
}

@Override
public boolean removeIf(final Predicate<? super E> filter) {
final var size = this.seq.size;
return size != this.seq.removeAll(filter::test).size;
}

@Override
public void forEach(final Consumer<? super E> action) {
this.seq.forEach(action);
}

@Override
public int size() {
return this.seq.size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.BiConsumer;
import org.checkerframework.checker.nullness.qual.Nullable;

/**
Expand Down Expand Up @@ -102,11 +101,6 @@ public V getOrDefault(final Object key, final V defaultValue) {
return this.map.get((K) key, defaultValue);
}

@Override
public void forEach(final BiConsumer<? super K, ? super V> action) {
this.map.each(action::accept);
}

@Override
public Set<Entry<K, V>> entrySet() {
if (this.entries == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.util.AbstractSet;
import java.util.Iterator;
import java.util.Set;
import java.util.function.Consumer;

/**
* A wrapper {@link Set} for an {@link ObjectSet}.
Expand All @@ -42,14 +41,9 @@ final class ArcSet<E> extends AbstractSet<E> implements Serializable {
this.set = set;
}

@Override
public void forEach(final Consumer<? super E> action) {
this.set.forEach(action);
}

@Override
public Iterator<E> iterator() {
return this.set.iterator();
return this.set.new ObjectSetIterator();
}

@Override
Expand All @@ -68,16 +62,6 @@ public boolean contains(final Object o) {
return this.set.contains((E) o);
}

@Override
public Object[] toArray() {
return this.set.toSeq().toArray();
}

@Override
public <T> T[] toArray(final T[] a) {
return this.set.toSeq().toArray(a.getClass().getComponentType());
}

@Override
public boolean add(final E e) {
return this.set.add(e);
Expand Down

0 comments on commit 1506167

Please sign in to comment.