Class SetView<E>

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

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

All methods declared in XGettingSet are transparently passed to the wrapped set.
All modifying methods declared in Collection and Set(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 set without either the danger of the set being modified from the outside or the need to copy the whole set 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).