Class ListView<E>

java.lang.Object
one.microstream.collections.ListView<E>
All Implemented Interfaces:
Iterable<E>, CapacityCarrying, ExtendedBag<E>, ExtendedCollection<E>, ExtendedList<E>, ExtendedSequence<E>, Sized, XGettingBag<E>, XGettingCollection<E>, XGettingList<E>, XGettingSequence<E>, XIndexIterable<E>, XIterable<E>, XJoinable<E>, Copyable

public class ListView<E>
extends Object
implements XGettingList<E>
Wrapper class that reduces the services provided by any wrapped XGettingList to only those ofXGettingList, effectively making the wrapped XGettingList instance immutable (or read-only) if used through an instance of this class.

All methods declared in XGettingList are transparently passed to the wrapped list.
All modifying methods declared in Collection and List(all variations of add~(), remove~() and retain~() as well as set() and clear()) immediately throw an UnsupportedOperationException when called.

This concept can be very useful if a class wants to provide public read access to an internal list without either the danger of the list being modified from the outside or the need to copy the whole list on every access.

This is one of many useful concepts that are missing in the JDK Collections Framework and thus so far lead to either inefficient or unneccessary verbose program code (or both).