Class EnumView<E>

java.lang.Object
one.microstream.collections.EnumView<E>
All Implemented Interfaces:
Iterable<E>, CapacityCarrying, ExtendedCollection<E>, ExtendedSequence<E>, Sized, XGettingCollection<E>, XGettingEnum<E>, XGettingSequence<E>, XGettingSet<E>, XIndexIterable<E>, XIterable<E>, XJoinable<E>, Copyable

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

All methods declared in XGettingEnum are transparently passed to the wrapped enuM.
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 enuM without either the danger of the enuM being modified from the outside or the need to copy the whole enuM 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).