E
- the type of elements in this collectionpublic 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<? extends E> coll) |
void |
clear() |
protected BoundedCollection<E> |
decorated()
Gets the collection being decorated.
|
boolean |
isFull()
Returns true if this collection is full and no new elements can be added.
|
Iterator<E> |
iterator() |
int |
maxSize()
Gets the maximum size of the collection (the bound).
|
boolean |
remove(Object object) |
boolean |
removeAll(Collection<?> coll) |
boolean |
removeIf(Predicate<? super E> filter) |
boolean |
retainAll(Collection<?> coll) |
static <E> BoundedCollection<E> |
unmodifiableBoundedCollection(BoundedCollection<? extends E> coll)
Factory method to create an unmodifiable bounded collection.
|
static <E> BoundedCollection<E> |
unmodifiableBoundedCollection(Collection<? extends E> coll)
Factory method to create an unmodifiable bounded collection.
|
contains, containsAll, isEmpty, setCollection, size, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
contains, containsAll, equals, hashCode, isEmpty, parallelStream, size, spliterator, stream, toArray, toArray
public static <E> BoundedCollection<E> unmodifiableBoundedCollection(BoundedCollection<? extends E> coll)
E
- the type of the elements in the collectioncoll
- the BoundedCollection
to decorate, must not be nullNullPointerException
- 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 collectioncoll
- the BoundedCollection
to decorate, must not be nullNullPointerException
- if coll is nullIllegalArgumentException
- if coll is not a BoundedCollection
public Iterator<E> iterator()
iterator
in interface Iterable<E>
iterator
in interface Collection<E>
iterator
in class AbstractCollectionDecorator<E>
public boolean add(E object)
add
in interface Collection<E>
add
in class AbstractCollectionDecorator<E>
public boolean addAll(Collection<? extends E> coll)
addAll
in interface Collection<E>
addAll
in class AbstractCollectionDecorator<E>
public void clear()
clear
in interface Collection<E>
clear
in class AbstractCollectionDecorator<E>
public boolean remove(Object object)
remove
in interface Collection<E>
remove
in class AbstractCollectionDecorator<E>
public boolean removeIf(Predicate<? super E> filter)
removeIf
in interface Collection<E>
removeIf
in class AbstractCollectionDecorator<E>
public boolean removeAll(Collection<?> coll)
removeAll
in interface Collection<E>
removeAll
in class AbstractCollectionDecorator<E>
public boolean retainAll(Collection<?> coll)
retainAll
in interface Collection<E>
retainAll
in class AbstractCollectionDecorator<E>
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>
Copyright © 2001–2019 The Apache Software Foundation. All rights reserved.