summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/src/ch/asynk/gdx/boardgame/utils/Collection.java2
-rw-r--r--core/src/ch/asynk/gdx/boardgame/utils/IterableArray.java9
2 files changed, 11 insertions, 0 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/utils/Collection.java b/core/src/ch/asynk/gdx/boardgame/utils/Collection.java
index 220e4c7..22b61b6 100644
--- a/core/src/ch/asynk/gdx/boardgame/utils/Collection.java
+++ b/core/src/ch/asynk/gdx/boardgame/utils/Collection.java
@@ -22,6 +22,8 @@ public interface Collection<E> extends Iterator<E>, Iterable<E>
public boolean insert(E e, int idx);
+ public boolean replace(E e, int idx);
+
public E remove(int idx);
public boolean remove(E e);
diff --git a/core/src/ch/asynk/gdx/boardgame/utils/IterableArray.java b/core/src/ch/asynk/gdx/boardgame/utils/IterableArray.java
index f592baa..8ec7eb2 100644
--- a/core/src/ch/asynk/gdx/boardgame/utils/IterableArray.java
+++ b/core/src/ch/asynk/gdx/boardgame/utils/IterableArray.java
@@ -91,6 +91,15 @@ public class IterableArray<E> implements Collection<E>
return true;
}
+ @Override public boolean replace(E e, int idx)
+ {
+ if (idx < s) {
+ data[idx] = e;
+ return true;
+ }
+ return false;
+ }
+
@Override public E remove(int i)
{
E e = data[i];