summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/rustanddust/engine/util/Collection.java2
-rw-r--r--core/src/ch/asynk/rustanddust/engine/util/IterableArray.java10
2 files changed, 12 insertions, 0 deletions
diff --git a/core/src/ch/asynk/rustanddust/engine/util/Collection.java b/core/src/ch/asynk/rustanddust/engine/util/Collection.java
index 67ea169..1feb937 100644
--- a/core/src/ch/asynk/rustanddust/engine/util/Collection.java
+++ b/core/src/ch/asynk/rustanddust/engine/util/Collection.java
@@ -20,6 +20,8 @@ public interface Collection<E> extends Iterator, Iterable<E>
public boolean add(E e);
+ public boolean insert(E e, int idx);
+
public E remove(int idx);
public boolean remove(E e);
diff --git a/core/src/ch/asynk/rustanddust/engine/util/IterableArray.java b/core/src/ch/asynk/rustanddust/engine/util/IterableArray.java
index f1473dd..08acb78 100644
--- a/core/src/ch/asynk/rustanddust/engine/util/IterableArray.java
+++ b/core/src/ch/asynk/rustanddust/engine/util/IterableArray.java
@@ -91,6 +91,16 @@ public class IterableArray<E> implements Collection<E>
}
@Override
+ public boolean insert(E e, int idx)
+ {
+ ensureCapacity(s + 1);
+ System.arraycopy(data, idx, data, idx+1, (s - idx));
+ data[idx] = e;
+ s += 1;
+ return true;
+ }
+
+ @Override
public E remove(int i)
{
E e = data[i];