edu.tum.cs.commons.collections
Class UnmodifiableSet<E>
java.lang.Object
edu.tum.cs.commons.collections.UnmodifiableCollection<E>
edu.tum.cs.commons.collections.UnmodifiableSet<E>
- All Implemented Interfaces:
- Serializable, Iterable<E>, Collection<E>, Set<E>
- Direct Known Subclasses:
- UnmodifiableSortedSet
public class UnmodifiableSet<E>
- extends UnmodifiableCollection<E>
- implements Set<E>
This is a wrapper for a Set 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.unmodifiableSet(java.util.Set), but by making it a
public class we can make the return value of some methods more explicit.
- Version:
- $Revision: 26283 $
- Author:
- Benjamin Hummel, $Author: juergens $
- See Also:
- Serialized Form
- Rating:
- GREEN Hash: 1221FC9A0B5282EB5A1323A35B955157
| 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 interface java.util.Set |
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
UnmodifiableSet
public UnmodifiableSet(Set<E> s)
- Creates a new unmodifiable set from another set. All modifications to the
underlying set will directly be visible in this wrapper.
TUM CCSM Commons - 2.7