Class FixedArrayList<E>

java.lang.Object
org.graphstream.util.set.FixedArrayList<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>, RandomAccess

public class FixedArrayList<E>
extends Object
implements Collection<E>, RandomAccess
Array list with immutable element indices.

A fixed array list is like an array list, but it ensures the property that each element will always stay at the same index, even if elements are removed in between. The counterpart of this property is that the array handles by itself the insertion of new elements (since when an element is removed in the middle, this position can be reused), and therefore indices cannot be chosen (i.e. only the add(Object) and addAll(Collection) methods are usable to insert new elements in the array).

This is the reason why this does not implement the List interface, because the add(int,E) method cannot be implemented.

Furthermore, this array cannot contain null values, because it marks unused positions within the array using the null value.

Since:
20040912
Author:
Antoine Dutot