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 | Field and Description |
|---|---|
| private static final long | serialVersionUID
Hides org. |
| Access | Constructor and Description |
|---|---|
| private | UnmodifiableBoundedCollection(final BoundedCollection<? extends E>
the collection to decorate, must not be null coll)Constructor that wraps (not copies). |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | add(final E
element whose presence in this collection is to be ensured object)Overrides org. Implements java. |
| public boolean | addAll(final Collection<? extends E>
collection containing elements to be added to this collection coll)Overrides org. Implements java. |
| public void | clear()
Overrides org. Implements java. |
| protected BoundedCollection | decorated()
Overrides org. |
| public boolean | isFull()
Implements org. |
| public Iterator | iterator()
Overrides org. Implements java. |
| public int | maxSize()
Implements org. |
| public boolean | remove(final Object
element to be removed from this collection, if present object)Overrides org. Implements java. |
| public boolean | removeAll(final Collection<?>
collection containing elements to be removed from this collection coll)Overrides org. Implements java. |
| public boolean | removeIf(final Predicate<? super E>
a predicate which returns filter)true for elements to be
removedOverrides org. Overrides default java. |
| public boolean | retainAll(final Collection<?>
collection containing elements to be retained in this collection coll)Overrides org. Implements java. |
| public static < the type of the elements in the collection E> BoundedCollection | Returns: a new unmodifiable bounded collectionthe coll)BoundedCollection to decorate, must not be nullFactory method to create an unmodifiable bounded collection. |
| public static < the type of the elements in the collection E> BoundedCollection | Returns: a new unmodifiable bounded collectionthe coll)BoundedCollection to decorate, must not be nullFactory method to create an unmodifiable bounded collection. |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides org. Serialization version | |
| UnmodifiableBoundedCollection | back to summary |
|---|---|
| private UnmodifiableBoundedCollection(final BoundedCollection<? extends E> coll) Constructor that wraps (not copies).
| |
| add | back to summary |
|---|---|
| public boolean add(final E object) Overrides org. Implements java. Doc from java. Ensures that this collection contains the specified element (optional
operation). Returns
Collections that support this operation may place limitations on what
elements may be added to this collection. In particular, some
collections will refuse to add
If a collection refuses to add a particular element for any reason
other than that it already contains the element, it must throw
an exception (rather than returning
| |
| addAll | back to summary |
|---|---|
| public boolean addAll(final Collection<? extends E> coll) Overrides org. Implements java. Doc from java. Adds all of the elements in the specified collection to this collection (optional operation). The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this collection, and this collection is nonempty.) If the specified collection has a defined encounter order, processing of its elements generally occurs in that order.
| |
| clear | back to summary |
|---|---|
| public void clear() Overrides org. Implements java. Doc from java. Removes all of the elements from this collection (optional operation). The collection will be empty after this method returns.
| |
| decorated | back to summary |
|---|---|
| protected BoundedCollection Overrides org. Doc from org. Gets the collection being decorated. All access to the decorated collection goes via this method.
| |
| isFull | back to summary |
|---|---|
| public boolean isFull() Implements org. Doc from org. Returns true if this collection is full and no new elements can be added.
| |
| iterator | back to summary |
|---|---|
| public Iterator Overrides org. Implements java. Doc from java. Returns an iterator over the elements in this collection. There are no guarantees concerning the order in which the elements are returned (unless this collection is an instance of some class that provides a guarantee). | |
| maxSize | back to summary |
|---|---|
| public int maxSize() Implements org. Doc from org. Gets the maximum size of the collection (the bound).
| |
| remove | back to summary |
|---|---|
| public boolean remove(final Object object) Overrides org. Implements java. Doc from java. Removes a single instance of the specified element from this
collection, if it is present (optional operation). More formally,
removes an element | |
| removeAll | back to summary |
|---|---|
| public boolean removeAll(final Collection<?> coll) Overrides org. Implements java. Doc from java. Removes all of this collection's elements that are also contained in the specified collection (optional operation). After this call returns, this collection will contain no elements in common with the specified collection.
| |
| removeIf | back to summary |
|---|---|
| public boolean removeIf(final Predicate<? super E> filter) Overrides org. Overrides default java. Doc from java. Removes all of the elements of this collection that satisfy the given predicate. Errors or runtime exceptions thrown during iteration or by the predicate are relayed to the caller. | |
| retainAll | back to summary |
|---|---|
| public boolean retainAll(final Collection<?> coll) Overrides org. Implements java. Doc from java. Retains only the elements in this collection that are contained in the specified collection (optional operation). In other words, removes from this collection all of its elements that are not contained in the specified collection.
| |
| unmodifiableBoundedCollection | back to summary |
|---|---|
| public static <E> BoundedCollection Factory method to create an unmodifiable bounded collection.
| |
| unmodifiableBoundedCollection | back to summary |
|---|---|
| public static <E> BoundedCollection 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.
| |