summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-01-11 01:33:22 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-01-11 01:33:22 +0100
commit1f5cabbb44744310673f7cd28f2cf95df28fe9e5 (patch)
treed5809a28b756285ebb2b8022200b6405ba69b40f /core
parent7df51c33f5a486a967a2550fdcf7664af1678dd2 (diff)
downloadRustAndDust-1f5cabbb44744310673f7cd28f2cf95df28fe9e5.zip
RustAndDust-1f5cabbb44744310673f7cd28f2cf95df28fe9e5.tar.gz
ArrayListIt: add addUnique
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/rustanddust/engine/util/ArrayListIt.java7
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()