public final class UnmodifiableBoundedCollection<E> extends AbstractCollectionDecorator<E> implements BoundedCollection <E>, Unmodifiable
UnmodifiableBoundedCollection decorates another
BoundedCollection to ensure it can't be altered.
If a BoundedCollection is first wrapped in some other collection decorator, such as synchronized or predicated, the BoundedCollection methods are no longer accessible. The factory on this class will attempt to retrieve the bounded nature by examining the package scope variables.
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()
|
protected BoundedCollection |
decorated()
Gets the collection being decorated.
|
boolean |
isFull()
Returns true if this collection is full and no new elements can be added.
|
Iterator |
iterator()
|
int |
maxSize()
Gets the maximum size of the collection (the bound).
|
boolean |
remove(Object
|
boolean |
removeAll(Collection
|
boolean |
retainAll(Collection
|
static <E> BoundedCollection |
unmodifiableBoundedCollection(BoundedCollection
Factory method to create an unmodifiable bounded collection.
|
static <E> BoundedCollection |
unmodifiableBoundedCollection(Collection
Factory method to create an unmodifiable bounded collection.
|
contains, containsAll, isEmpty, setCollection, size, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontains, containsAll, equals, hashCode, isEmpty, parallelStream, removeIf, size, spliterator, stream, toArray, toArraypublic static <E> BoundedCollection<E> unmodifiableBoundedCollection(BoundedCollection <? extends E> coll)
E - the type of the elements in the collection
coll - the
BoundedCollection to decorate, must not be null
NullPointerException - if
coll is
null
public static <E> BoundedCollection<E> unmodifiableBoundedCollection(Collection <? extends E> coll)
This method is capable of drilling down through up to 1000 other decorators to find a suitable BoundedCollection.
E - the type of the elements in the collection
coll - the
BoundedCollection to decorate, must not be null
NullPointerException - if coll is null
IllegalArgumentException - if coll is not a
BoundedCollection
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)
public boolean isFull()
BoundedCollection
isFull in interface
BoundedCollection<E>
true if the collection is full
public int maxSize()
BoundedCollection
maxSize in interface
BoundedCollection<E>
protected BoundedCollection<E> decorated()
AbstractCollectionDecorator
decorated in class
AbstractCollectionDecorator<E>