Package eu.simuline.util
Class CollectionsExt.ImmutableSortedSet<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- eu.simuline.util.CollectionsExt.AbstractImmutableCollection<java.util.SortedSet<E>,E>
-
- eu.simuline.util.CollectionsExt.ImmutableSortedSet<E>
-
- Type Parameters:
E- the class of the elements of this list.
- All Implemented Interfaces:
java.lang.Iterable<E>,java.util.Collection<E>,java.util.Set<E>,java.util.SortedSet<E>
- Enclosing class:
- CollectionsExt<E>
public static final class CollectionsExt.ImmutableSortedSet<E> extends CollectionsExt.AbstractImmutableCollection<java.util.SortedSet<E>,E> implements java.util.SortedSet<E>
A sorted set which prevents being modified by throwing an exception for the modifying methods.
-
-
Constructor Summary
Constructors Constructor Description ImmutableSortedSet(java.util.Set<CollectionsExt.Modification> mods, java.util.SortedSet<E> set)ImmutableSortedSet(java.util.SortedSet<E> set)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Comparator<? super E>comparator()Efirst()java.util.SortedSet<E>headSet(E toElement)Returns a view of the portion of this set whose elements are strictly less thantoElement.Elast()java.util.SortedSet<E>subSet(E fromElement, E toElement)Returns a view of the portion of this set whose elements range fromfromElement, inclusive, totoElement, exclusive.java.util.SortedSet<E>tailSet(E fromElement)Returns a view of the portion of this set whose elements are greater than or equal tofromElement.java.util.SortedSet<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
-
set
private final java.util.SortedSet<E> set
The enclosed sorted set containing the elements of this sorted set.
-
-
Constructor Detail
-
ImmutableSortedSet
ImmutableSortedSet(java.util.SortedSet<E> set)
-
ImmutableSortedSet
ImmutableSortedSet(java.util.Set<CollectionsExt.Modification> mods, java.util.SortedSet<E> set)
-
-
Method Detail
-
unrestricted
public java.util.SortedSet<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<java.util.SortedSet<E>,E>
-
comparator
public java.util.Comparator<? super E> comparator()
- Specified by:
comparatorin interfacejava.util.SortedSet<E>
-
headSet
public java.util.SortedSet<E> headSet(E toElement)
Returns a view of the portion of this set whose elements are strictly less thantoElement. For information on backing seesubSet(Object, Object).- Specified by:
headSetin interfacejava.util.SortedSet<E>
-
subSet
public java.util.SortedSet<E> subSet(E fromElement, E toElement)
Returns a view of the portion of this set whose elements range fromfromElement, inclusive, totoElement, exclusive. (If fromElement and toElement are equal, the returned set is empty.) The returned set is backed by this set, so changes in the returned set are reflected in this set, and vice-versa. The returned set supports all optional set operations that this set supports. In particular, changes of the allowed modifications (returned byCollectionsExt.AbstractImmutableCollection.allowedModifications()) of the returned set are reflected in this set, and vice-versa.- Specified by:
subSetin interfacejava.util.SortedSet<E>
-
tailSet
public java.util.SortedSet<E> tailSet(E fromElement)
Returns a view of the portion of this set whose elements are greater than or equal tofromElement. For information on backing seesubSet(Object, Object).- Specified by:
tailSetin interfacejava.util.SortedSet<E>
-
-