E - the type of the elements in the collectionpublic 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(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 |
removeIf(java.util.function.Predicate<? super E> filter) |
boolean |
retainAll(java.util.Collection<?> coll) |
static <T> java.util.Collection<T> |
unmodifiableCollection(java.util.Collection<? extends T> coll)
Factory method to create an unmodifiable collection.
|
contains, containsAll, isEmpty, size, toArray, toArray, toStringequals, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic static <T> java.util.Collection<T> unmodifiableCollection(java.util.Collection<? extends T> coll)
If the collection passed in is already unmodifiable, it is returned.
T - the type of the elements in the collectioncoll - the collection to decorate, must not be nulljava.lang.NullPointerException - if collection is nullpublic java.util.Iterator<E> iterator()
iterator in interface java.lang.Iterable<E>iterator in interface java.util.Collection<E>iterator in class AbstractCollectionDecorator<E>public boolean add(E object)
add in interface java.util.Collection<E>add in class AbstractCollectionDecorator<E>public boolean addAll(java.util.Collection<? extends E> coll)
addAll in interface java.util.Collection<E>addAll in class AbstractCollectionDecorator<E>public void clear()
clear in interface java.util.Collection<E>clear in class AbstractCollectionDecorator<E>public boolean remove(java.lang.Object object)
remove in interface java.util.Collection<E>remove in class AbstractCollectionDecorator<E>public boolean removeIf(java.util.function.Predicate<? super E> filter)
removeIf in interface java.util.Collection<E>removeIf in class AbstractCollectionDecorator<E>public boolean removeAll(java.util.Collection<?> coll)
removeAll in interface java.util.Collection<E>removeAll in class AbstractCollectionDecorator<E>public boolean retainAll(java.util.Collection<?> coll)
retainAll in interface java.util.Collection<E>retainAll in class AbstractCollectionDecorator<E>Copyright © 2010 - 2023 Adobe. All Rights Reserved