Provides a list with similar modification semantics to java.util.concurrent's CopyOnWriteArrayList except that it is not concurrent and also provides direct access to the current array. This List allows modification of the contents while iterating as any iterators will be looking at a snapshot of the list at the time they were created. Similarly, access the raw internal array is only presenting a snap shot and so can be safely iterated while the list is changing.
All modifications, including set() operations will cause a copy of the data to be created that replaces the old version. Because this list is not designed for threading concurrency it further optimizes the "many modifications" case by buffering them as a normal ArrayList until the next time the contents are accessed.
Normal list modification performance should be equal to ArrayList in a many situations and always better than CopyOnWriteArrayList. Optimum usage is when modifications are done infrequently or in batches... as is often the case in a scene graph. Read operations perform superior to all other methods as the array can be accessed directly.
Important caveats over normal java.util.Lists:
|
|