|
TUM CCSM Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.tum.cs.commons.collections.UnmodifiableCollection<E>
edu.tum.cs.commons.collections.UnmodifiableSet<E>
edu.tum.cs.commons.collections.UnmodifiableSortedSet<E>
public class UnmodifiableSortedSet<E>
This is a wrapper for a SortedSet
prohibiting all calls which would
modify its contents. As the construction of this class is performed in
constant time it is prefered over copying the set (which takes linear time).
Using this class is also preferred to using the unmodifiableX()
in class Collections
as they return the collection base type that
does not signal, that the object ist unmodifiable. Using the classes in this
package makes unmodifiability more explicit.
All prohibited methods throw an UnsupportedOperationException
. The
class is nearly the same as the one returned by
Collections.unmodifiableSortedSet(java.util.SortedSet)
, but by
making it a public class we can make the return value of some methods more
explicit.
Constructor Summary | |
---|---|
UnmodifiableSortedSet(java.util.SortedSet<E> s)
Creates a new unmodifiable sorted set from another sorted set. |
Method Summary | |
---|---|
java.util.Comparator<? super E> |
comparator()
|
E |
first()
|
UnmodifiableSortedSet<E> |
headSet(E toElement)
|
E |
last()
|
UnmodifiableSortedSet<E> |
subSet(E fromElement,
E toElement)
|
UnmodifiableSortedSet<E> |
tailSet(E fromElement)
|
Methods inherited from class edu.tum.cs.commons.collections.UnmodifiableCollection |
---|
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Set |
---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Constructor Detail |
---|
public UnmodifiableSortedSet(java.util.SortedSet<E> s)
Method Detail |
---|
public java.util.Comparator<? super E> comparator()
comparator
in interface java.util.SortedSet<E>
public E first()
first
in interface java.util.SortedSet<E>
public UnmodifiableSortedSet<E> headSet(E toElement)
headSet
in interface java.util.SortedSet<E>
public E last()
last
in interface java.util.SortedSet<E>
public UnmodifiableSortedSet<E> subSet(E fromElement, E toElement)
subSet
in interface java.util.SortedSet<E>
public UnmodifiableSortedSet<E> tailSet(E fromElement)
tailSet
in interface java.util.SortedSet<E>
|
TUM CCSM Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |