E - the type of the elements in the collection
public final class UnmodifiableCollection<E> extends AbstractCollectionDecorator<E> implements Unmodifiable
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.
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E object)
|
boolean |
addAll(Collection
|
void |
clear()
|
Iterator |
iterator()
|
boolean |
remove(Object
|
boolean |
removeAll(Collection
|
boolean |
retainAll(Collection
|
static <T> Collection |
unmodifiableCollection(Collection
Factory method to create an unmodifiable collection.
|
contains, containsAll, decorated, isEmpty, setCollection, size, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitequals, hashCode, parallelStream, removeIf, spliterator, streampublic static <T> Collection<T> unmodifiableCollection(Collection <? extends T> coll)
If the collection passed in is already unmodifiable, it is returned.
T - the type of the elements in the collection
coll - the collection to decorate, must not be null
NullPointerException - if collection is null
public boolean add(E object)
public boolean addAll(Collection<? extends E> coll)
public void clear()
public boolean remove(Objectobject)
public boolean removeAll(Collection<?> coll)
public boolean retainAll(Collection<?> coll)