diff options
Diffstat (limited to 'src/Java/gtPlusPlus/api/objects/data/AutoMap.java')
-rw-r--r-- | src/Java/gtPlusPlus/api/objects/data/AutoMap.java | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java index 3583a04a74..02517097cf 100644 --- a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java +++ b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java @@ -70,6 +70,20 @@ public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable, Collect } } } + + /** + * Generates an AutoMap from a Array. + * @param aArray - Data to be inserted into the AutoMap. + */ + public AutoMap(V[] aArray) { + mInternalMap = new LinkedHashMap<Integer, V>(); + mInternalNameMap = new LinkedHashMap<String, Integer>(); + if (aArray != null && aArray.length > 0) { + for (V obj : aArray) { + add(obj); + } + } + } @Override public Iterator<V> iterator() { @@ -212,11 +226,12 @@ public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable, Collect @Override public boolean retainAll(Collection<?> c) { - AutoMap<?> aTempAllocation = new AutoMap(); + AutoMap<?> aTempAllocation = new AutoMap<Object>(); boolean aTrue = false; aTempAllocation = this; - aTempAllocation.removeAll(c); - aTrue = this.removeAll(aTempAllocation); + aTempAllocation.removeAll(c); + aTempAllocation.clear(); + aTrue = aTempAllocation.isEmpty(); aTempAllocation.clear(); return aTrue; } |