Package eu.simuline.util
Class CollectionsExt.ImmutableCollection<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- eu.simuline.util.CollectionsExt.AbstractImmutableCollection<Collection<E>,E>
-
- eu.simuline.util.CollectionsExt.ImmutableCollection<E>
-
- Type Parameters:
E- the class of the elements of this collection.
- All Implemented Interfaces:
Iterable<E>,Collection<E>
- Enclosing class:
- CollectionsExt<E>
public static final class CollectionsExt.ImmutableCollection<E> extends CollectionsExt.AbstractImmutableCollection<Collection<E>,E> implements Collection<E>
A collection which prevents being modified by throwing an exception for the modifying methods.
-
-
Field Summary
Fields Modifier and Type Field Description private Collection<E>collThe enclosed set containing the elements of this set.
-
Constructor Summary
Constructors Constructor Description ImmutableCollection(Collection<E> coll)Creates a new emptyImmutableCollectionwhich equalscollbut cannot be modified neither directly nor via its iterator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<E>unrestricted()Returns the underlying set without the restrictions imposed by thisCollectionsExt.ImmutableCollection.-
Methods inherited from class eu.simuline.util.CollectionsExt.AbstractImmutableCollection
add, addAll, allowedModifications, allowModification, allowModifications, clear, iterator, remove, removeAll, removeIf, retainAll, size, toString
-
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, toArray, toArray
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
coll
private final Collection<E> coll
The enclosed set containing the elements of this set.
-
-
Constructor Detail
-
ImmutableCollection
ImmutableCollection(Collection<E> coll)
Creates a new emptyImmutableCollectionwhich equalscollbut cannot be modified neither directly nor via its iterator.- Throws:
NullPointerException- ifcoll==null.
-
-
Method Detail
-
unrestricted
public Collection<E> unrestricted()
Description copied from class:CollectionsExt.AbstractImmutableCollectionReturns the underlying set without the restrictions imposed by thisCollectionsExt.ImmutableCollection. Note that the result may still throwUnsupportedOperationExceptions depending on the implementation.- Specified by:
unrestrictedin classCollectionsExt.AbstractImmutableCollection<Collection<E>,E>
-
-