gov.llnl.ontology.util
Class ExtendedList<T>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<T>
gov.llnl.ontology.util.ExtendedList<T>
- All Implemented Interfaces:
- Iterable<T>, Collection<T>, List<T>
public class ExtendedList<T>
- extends AbstractList<T>
A List that extends an existing List without modifying the
original List. New items added to this List are stored in an
internal List that represents all of the values proceeding the
elements in the extended List. The extended List is
unmodified.
This is extermely useful for applications that need to make different
extensions to an existing List but cannot make multiple copies of the
original List due to memory constraints.
- Author:
- Keith Stevens
| Methods inherited from class java.util.AbstractList |
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList |
ExtendedList
public ExtendedList(List<T> baseItems)
- Creates a new extended view of the given
List. Any new items
added to the ExtendedList with calls to add will be added
to a secondary List, and thus leave baseItems unmodified.
Only read access is given to baseItems. As long as baseItems is synchronized, it can be extended with multiple ExtendedLists without and concern.
add
public boolean add(T e)
-
- Specified by:
add in interface Collection<T>- Specified by:
add in interface List<T>- Overrides:
add in class AbstractList<T>
get
public T get(int index)
-
- Specified by:
get in interface List<T>- Specified by:
get in class AbstractList<T>
size
public int size()
-
- Specified by:
size in interface Collection<T>- Specified by:
size in interface List<T>- Specified by:
size in class AbstractCollection<T>
Copyright © 2010-2011. All Rights Reserved.