Class UnmodifiableSet
java.lang.Object
org.apache.commons.collections.collection.AbstractCollectionDecorator
org.apache.commons.collections.set.AbstractSetDecorator
org.apache.commons.collections.set.AbstractSerializableSetDecorator
org.apache.commons.collections.set.UnmodifiableSet
- All Implemented Interfaces:
Serializable,Iterable,Collection,Set,Unmodifiable
Decorates another
Set to ensure it can't be altered.
This class is Serializable from Commons Collections 3.1.
- Since:
- Commons Collections 3.0
- Version:
- $Revision: 646777 $ $Date: 2008-04-10 14:33:15 +0200 (Thu, 10 Apr 2008) $
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longSerialization versionFields inherited from class org.apache.commons.collections.collection.AbstractCollectionDecorator
collection -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateUnmodifiableSet(Set set) Constructor that wraps (not copies). -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection coll) voidclear()static SetFactory method to create an unmodifiable set.iterator()booleanbooleanremoveAll(Collection coll) booleanretainAll(Collection coll) Methods inherited from class org.apache.commons.collections.set.AbstractSetDecorator
getSetMethods inherited from class org.apache.commons.collections.collection.AbstractCollectionDecorator
contains, containsAll, equals, getCollection, hashCode, isEmpty, size, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, streamMethods inherited from interface java.util.Set
contains, containsAll, equals, hashCode, isEmpty, size, spliterator, toArray, toArray
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version- See Also:
-
-
Constructor Details
-
UnmodifiableSet
Constructor that wraps (not copies).- Parameters:
set- the set to decorate, must not be null- Throws:
IllegalArgumentException- if set is null
-
-
Method Details
-
decorate
Factory method to create an unmodifiable set.- Parameters:
set- the set to decorate, must not be null- Throws:
IllegalArgumentException- if set is null
-
iterator
- Specified by:
iteratorin interfaceCollection- Specified by:
iteratorin interfaceIterable- Specified by:
iteratorin interfaceSet- Overrides:
iteratorin classAbstractCollectionDecorator
-
add
- Specified by:
addin interfaceCollection- Specified by:
addin interfaceSet- Overrides:
addin classAbstractCollectionDecorator
-
addAll
- Specified by:
addAllin interfaceCollection- Specified by:
addAllin interfaceSet- Overrides:
addAllin classAbstractCollectionDecorator
-
clear
public void clear()- Specified by:
clearin interfaceCollection- Specified by:
clearin interfaceSet- Overrides:
clearin classAbstractCollectionDecorator
-
remove
- Specified by:
removein interfaceCollection- Specified by:
removein interfaceSet- Overrides:
removein classAbstractCollectionDecorator
-
removeAll
- Specified by:
removeAllin interfaceCollection- Specified by:
removeAllin interfaceSet- Overrides:
removeAllin classAbstractCollectionDecorator
-
retainAll
- Specified by:
retainAllin interfaceCollection- Specified by:
retainAllin interfaceSet- Overrides:
retainAllin classAbstractCollectionDecorator
-