Class AbstractShrinkableList<E>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
org.nasengolem.util.datastructures.AbstractShrinkableList<E>
Type Parameters:
E - the type of elements in this list
All Implemented Interfaces:
Iterable<E>, Collection<E>, List<E>, SequencedCollection<E>, Shrinkable
Direct Known Subclasses:
CappedList

public abstract class AbstractShrinkableList<E> extends AbstractList<E> implements List<E>, Shrinkable
This class extends the AbstractList skeleton by implementing Shrinkable. This means, that the end of the list can be cut off in constant time. The following idioms utilize the shrink(int) method to increase performance when deleting the last elements of the list.
      list.removeLast(numberOfElements);
      list.subList(from, size()).clear();
      list.clear();
 
Author:
Paul Steinbach