Prevent concurrent modification exception when moving token to a zone besides the graveyard

This commit is contained in:
drdev
2014-10-15 16:07:54 +00:00
parent ab7fb0788e
commit 99e2b67e04
3 changed files with 32 additions and 9 deletions

View File

@@ -251,4 +251,10 @@ public class FCollection<T> implements List<T>, Set<T>, FCollectionView<T>, Clon
}
return subList;
}
@Override
public Iterable<T> threadSafeIterator() {
//create a new linked list for iterating to make it thread safe and avoid concurrent modification exceptions
return new LinkedList<T>(list);
}
}

View File

@@ -13,4 +13,5 @@ public interface FCollectionView<T> extends Iterable<T> {
int lastIndexOf(Object o);
boolean contains(Object o);
List<T> subList(int fromIndex, int toIndex);
Iterable<T> threadSafeIterator();
}