diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-01-11 01:33:22 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-01-11 01:33:22 +0100 |
commit | 1f5cabbb44744310673f7cd28f2cf95df28fe9e5 (patch) | |
tree | d5809a28b756285ebb2b8022200b6405ba69b40f /core/src/ch/asynk/rustanddust | |
parent | 7df51c33f5a486a967a2550fdcf7664af1678dd2 (diff) | |
download | RustAndDust-1f5cabbb44744310673f7cd28f2cf95df28fe9e5.zip RustAndDust-1f5cabbb44744310673f7cd28f2cf95df28fe9e5.tar.gz |
ArrayListIt: add addUnique
Diffstat (limited to 'core/src/ch/asynk/rustanddust')
-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() |