diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/rustanddust/engine/util/ArrayListIt.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/util/ArrayListIt.java b/core/src/ch/asynk/rustanddust/engine/util/ArrayListIt.java index 37e4b1f..16990eb 100644 --- a/core/src/ch/asynk/rustanddust/engine/util/ArrayListIt.java +++ b/core/src/ch/asynk/rustanddust/engine/util/ArrayListIt.java @@ -38,6 +38,13 @@ public class ArrayListIt<E> extends ArrayList<E> implements Iterator, Iterable<E return remove(0); } + public boolean addUnique(E e) + { + if (contains(e)) return false; + super.add(e); + return true; + } + @Override @SuppressWarnings("unchecked") public Iterator<E> iterator() |