Class UnmodifiableBoundedCollection<E>
java.lang.Object
org.apache.commons.collections4.collection.AbstractCollectionDecorator<E>
org.apache.commons.collections4.collection.UnmodifiableBoundedCollection<E>
- Type Parameters:
- E- the type of elements in this collection
- All Implemented Interfaces:
- Serializable,- Iterable<E>,- Collection<E>,- BoundedCollection<E>,- Unmodifiable
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.
- Since:
- 3.0
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends E> coll) voidclear()protected BoundedCollection<E> Gets the collection being decorated.booleanisFull()Returns true if this collection is full and no new elements can be added.iterator()intmaxSize()Gets the maximum size of the collection (the bound).booleanbooleanremoveAll(Collection<?> coll) booleanbooleanretainAll(Collection<?> coll) static <E> BoundedCollection<E> unmodifiableBoundedCollection(Collection<? extends E> collection) Factory method to create an unmodifiable bounded collection.static <E> BoundedCollection<E> unmodifiableBoundedCollection(BoundedCollection<? extends E> coll) Factory method to create an unmodifiable bounded collection.Methods inherited from class org.apache.commons.collections4.collection.AbstractCollectionDecoratorcontains, containsAll, 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.Collectioncontains, containsAll, equals, hashCode, isEmpty, parallelStream, size, spliterator, stream, toArray, toArray
- 
Method Details- 
unmodifiableBoundedCollectionpublic static <E> BoundedCollection<E> unmodifiableBoundedCollection(BoundedCollection<? extends E> coll) Factory method to create an unmodifiable bounded collection.- Type Parameters:
- E- the type of the elements in the collection
- Parameters:
- coll- the- BoundedCollectionto decorate, must not be null
- Returns:
- a new unmodifiable bounded collection
- Throws:
- NullPointerException- if- collis- null
- Since:
- 4.0
 
- 
unmodifiableBoundedCollectionpublic static <E> BoundedCollection<E> unmodifiableBoundedCollection(Collection<? extends E> collection) Factory method to create an unmodifiable bounded collection.This method is capable of drilling down through up to 1000 other decorators to find a suitable BoundedCollection. - Type Parameters:
- E- the type of the elements in the collection
- Parameters:
- collection- the- BoundedCollectionto decorate, must not be null
- Returns:
- a new unmodifiable bounded collection
- Throws:
- NullPointerException- if coll is null
- IllegalArgumentException- if coll is not a- BoundedCollection
- 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>
 
- 
decoratedDescription copied from class:AbstractCollectionDecoratorGets the collection being decorated. All access to the decorated collection goes via this method.- Overrides:
- decoratedin class- AbstractCollectionDecorator<E>
- Returns:
- the decorated collection
 
- 
isFullDescription copied from interface:BoundedCollectionReturns true if this collection is full and no new elements can be added.- Specified by:
- isFullin interface- BoundedCollection<E>
- Returns:
- trueif the collection is full.
 
- 
iterator
- 
maxSizeDescription copied from interface:BoundedCollectionGets the maximum size of the collection (the bound).- Specified by:
- maxSizein interface- BoundedCollection<E>
- Returns:
- the maximum number of elements the collection can hold.
 
- 
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>
 
 
-