public final class UnmodifiableCollection extends AbstractSerializableCollectionDecorator implements Unmodifiable
Collection
to ensure it can't be altered.
This class is Serializable from Commons Collections 3.1.
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID
Serialization version
|
collection
Modifier | Constructor and Description |
---|---|
private |
UnmodifiableCollection(java.util.Collection coll)
Constructor that wraps (not copies).
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(java.lang.Object object) |
boolean |
addAll(java.util.Collection coll) |
void |
clear() |
static java.util.Collection |
decorate(java.util.Collection coll)
Factory method to create an unmodifiable collection.
|
java.util.Iterator |
iterator() |
boolean |
remove(java.lang.Object object) |
boolean |
removeAll(java.util.Collection coll) |
boolean |
retainAll(java.util.Collection coll) |
contains, containsAll, equals, getCollection, hashCode, isEmpty, size, toArray, toArray, toString
private static final long serialVersionUID
private UnmodifiableCollection(java.util.Collection coll)
coll
- the collection to decorate, must not be nulljava.lang.IllegalArgumentException
- if collection is nullpublic static java.util.Collection decorate(java.util.Collection coll)
If the collection passed in is already unmodifiable, it is returned.
coll
- the collection to decorate, must not be nulljava.lang.IllegalArgumentException
- if collection is nullpublic java.util.Iterator iterator()
iterator
in interface java.lang.Iterable
iterator
in interface java.util.Collection
iterator
in class AbstractCollectionDecorator
public boolean add(java.lang.Object object)
add
in interface java.util.Collection
add
in class AbstractCollectionDecorator
public boolean addAll(java.util.Collection coll)
addAll
in interface java.util.Collection
addAll
in class AbstractCollectionDecorator
public void clear()
clear
in interface java.util.Collection
clear
in class AbstractCollectionDecorator
public boolean remove(java.lang.Object object)
remove
in interface java.util.Collection
remove
in class AbstractCollectionDecorator
public boolean removeAll(java.util.Collection coll)
removeAll
in interface java.util.Collection
removeAll
in class AbstractCollectionDecorator
public boolean retainAll(java.util.Collection coll)
retainAll
in interface java.util.Collection
retainAll
in class AbstractCollectionDecorator