info.aduna.collections
Class ListView<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.AbstractSequentialList<E>
info.aduna.collections.ListView<E>
- All Implemented Interfaces:
- Iterable<E>, Collection<E>, List<E>
public class ListView<E>
- extends AbstractSequentialList<E>
ListView represents an immutable view on another list, which is also assumed
to be immutable. As a result of this, iterators on instances of this class do
NOT support the (optional) modification operations.
createView
public static <E> ListView<E> createView(List<E> listToView,
BitSet viewedIndices)
listIterator
public ListIterator<E> listIterator(int index)
- Get an iterator over this view. Note that this iterator is NOT fail-fast
and does not monitor changes in the underlying list. Also note that
backwards iteration is likely to be significantly slower than forwards
iteration on large lists. The iterator supports none of optional
modification methods.
- Specified by:
listIterator in interface List<E>- Specified by:
listIterator in class AbstractSequentialList<E>
- Returns:
- an iterator over this view
size
public int size()
- The size of the view. Note that since the underlying list is assumed to
be immutable, the size will remain constant even when the underlying list
or the viewed indices change.
- Specified by:
size in interface Collection<E>- Specified by:
size in interface List<E>- Specified by:
size in class AbstractCollection<E>
- Returns:
- the number of elements in this view
Copyright © 1997-2008 Aduna. All Rights Reserved.