Class UnmodifiableCollection<E>
java.lang.Object
org.apache.commons.collections4.collection.AbstractCollectionDecorator<E>
org.apache.commons.collections4.collection.UnmodifiableCollection<E>
- Type Parameters:
- E- the type of the elements in the collection
- All Implemented Interfaces:
- Serializable,- Iterable<E>,- Collection<E>,- Unmodifiable
public final class UnmodifiableCollection<E>
extends AbstractCollectionDecorator<E>
implements Unmodifiable
Decorates another 
Collection 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.
- Since:
- 3.0
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends E> coll) voidclear()iterator()booleanbooleanremoveAll(Collection<?> coll) booleanbooleanretainAll(Collection<?> coll) static <T> Collection<T> unmodifiableCollection(Collection<? extends T> coll) Factory method to create an unmodifiable collection.Methods inherited from class org.apache.commons.collections4.collection.AbstractCollectionDecoratorcontains, containsAll, decorated, isEmpty, setCollection, size, toArray, toArray, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collectionequals, hashCode, parallelStream, spliterator, stream
- 
Method Details- 
unmodifiableCollectionFactory method to create an unmodifiable collection.If the collection passed in is already unmodifiable, it is returned. - Type Parameters:
- T- the type of the elements in the collection
- Parameters:
- coll- the collection to decorate, must not be null
- Returns:
- an unmodifiable collection
- Throws:
- NullPointerException- if collection is null
- Since:
- 4.0
 
- 
add- Specified by:
- addin interface- Collection<E>
- Overrides:
- addin class- AbstractCollectionDecorator<E>
 
- 
addAll- Specified by:
- addAllin interface- Collection<E>
- Overrides:
- addAllin class- AbstractCollectionDecorator<E>
 
- 
clear- Specified by:
- clearin interface- Collection<E>
- Overrides:
- clearin class- AbstractCollectionDecorator<E>
 
- 
iterator
- 
remove- Specified by:
- removein interface- Collection<E>
- Overrides:
- removein class- AbstractCollectionDecorator<E>
 
- 
removeAll- Specified by:
- removeAllin interface- Collection<E>
- Overrides:
- removeAllin class- AbstractCollectionDecorator<E>
 
- 
removeIf- Specified by:
- removeIfin interface- Collection<E>
- Overrides:
- removeIfin class- AbstractCollectionDecorator<E>
- Since:
- 4.4
 
- 
retainAll- Specified by:
- retainAllin interface- Collection<E>
- Overrides:
- retainAllin class- AbstractCollectionDecorator<E>
 
 
-