public final class UnmodifiableSet<E> extends AbstractSerializableSetDecorator<E> implements Unmodifiable
Set to ensure it can't be altered.
This class is Serializable from Commons Collections 3.1.
Attempts to modify it will result in an UnsupportedOperationException.
| Modifier and Type | Field and Description |
|---|---|
private static long |
serialVersionUID
Serialization version
|
| Modifier | Constructor and Description |
|---|---|
private |
UnmodifiableSet(java.util.Set<? extends E> set)
Constructor that wraps (not copies).
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E object) |
boolean |
addAll(java.util.Collection<? extends E> coll) |
void |
clear() |
java.util.Iterator<E> |
iterator() |
boolean |
remove(java.lang.Object object) |
boolean |
removeAll(java.util.Collection<?> coll) |
boolean |
retainAll(java.util.Collection<?> coll) |
static <E> java.util.Set<E> |
unmodifiableSet(java.util.Set<? extends E> set)
Factory method to create an unmodifiable set.
|
decoratedcontains, containsAll, equals, hashCode, isEmpty, setCollection, size, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitprivate static final long serialVersionUID
private UnmodifiableSet(java.util.Set<? extends E> set)
set - the set to decorate, must not be nulljava.lang.IllegalArgumentException - if set is nullpublic static <E> java.util.Set<E> unmodifiableSet(java.util.Set<? extends E> set)
E - the element typeset - the set to decorate, must not be nulljava.lang.IllegalArgumentException - if set is nullpublic java.util.Iterator<E> iterator()
public boolean add(E object)
add in interface java.util.Collection<E>add in interface java.util.Set<E>add in class AbstractCollectionDecorator<E>public boolean addAll(java.util.Collection<? extends E> coll)
addAll in interface java.util.Collection<E>addAll in interface java.util.Set<E>addAll in class AbstractCollectionDecorator<E>public void clear()
clear in interface java.util.Collection<E>clear in interface java.util.Set<E>clear in class AbstractCollectionDecorator<E>public boolean remove(java.lang.Object object)
remove in interface java.util.Collection<E>remove in interface java.util.Set<E>remove in class AbstractCollectionDecorator<E>public boolean removeAll(java.util.Collection<?> coll)
removeAll in interface java.util.Collection<E>removeAll in interface java.util.Set<E>removeAll in class AbstractCollectionDecorator<E>public boolean retainAll(java.util.Collection<?> coll)
retainAll in interface java.util.Collection<E>retainAll in interface java.util.Set<E>retainAll in class AbstractCollectionDecorator<E>