Bag to ensure it can't be altered.
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 | UnmodifiableBag(final Bag<? extends E>
the bag to decorate, must not be null bag)Constructor that wraps (not copies). |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | add(final E
the object to add object)Overrides org. Implements org. |
| public boolean | add(final E
the object to add object, final int the number of copies to add count)Overrides org. Implements org. nCopies copies of the specified object to the Bag.
|
| 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. |
| public Iterator | iterator()
Overrides org. Implements org. Iterator over the entire set of members,
including copies due to cardinality.
|
| private void | readObject(final ObjectInputStream
the input stream in)Read the collection in using a custom routine. |
| public boolean | remove(final Object
the object to remove object)Overrides org. Implements org. |
| public boolean | remove(final Object
the object to remove object, final int the number of copies to remove count)Overrides org. Implements org. nCopies copies of the specified object from the Bag.
|
| public boolean | removeAll(final Collection<?>
the collection to remove coll)Overrides org. Implements org. |
| public boolean | removeIf(Predicate<? super E>
a predicate which returns filter)true for elements to be
removedOverrides org. Overrides default java. |
| public boolean | retainAll(final Collection<?>
the collection to retain coll)Overrides org. Implements org. |
| public Set | uniqueSet()
Overrides org. Implements org. Set of unique elements in the Bag.
|
| public static < the type of the elements in the bag E> Bag | Returns: an unmodifiable Bagthe bag to decorate, must not be null bag)Factory method to create an unmodifiable bag. |
| private void | writeObject(final ObjectOutputStream
the output stream out)Write the collection out using a custom routine. |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides org. Serialization version | |
| UnmodifiableBag | back to summary |
|---|---|
| private UnmodifiableBag(final Bag<? extends E> bag) Constructor that wraps (not copies).
| |
| add | back to summary |
|---|---|
| public boolean add(final E object) Overrides org. Implements org. Doc from org. (Violation) Adds one copy of the specified object to the Bag.
If the object is already in the
Since this method always increases the size of the bag,
according to the
| |
| add | back to summary |
|---|---|
| public boolean add(final E object, final int count) Overrides org. Implements org. Doc from org. Adds
If the object is already in the
| |
| 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.
| |
| iterator | back to summary |
|---|---|
| public Iterator Overrides org. Implements org. Doc from org. Returns an | |
| readObject | back to summary |
|---|---|
| private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException Read the collection in using a custom routine.
| |
| remove | back to summary |
|---|---|
| public boolean remove(final Object object) Overrides org. Implements org. Doc from org. (Violation) Removes all occurrences of the given object from the bag.
This will also remove the object from the
According to the | |
| remove | back to summary |
|---|---|
| public boolean remove(final Object object, final int count) Overrides org. Implements org. Doc from org. Removes If the number of copies to remove is greater than the actual number of copies in the Bag, no error is thrown. | |
| removeAll | back to summary |
|---|---|
| public boolean removeAll(final Collection<?> coll) Overrides org. Implements org. Doc from org. (Violation)
Remove all elements represented in the given collection,
respecting cardinality. That is, if the given collection
The
| |
| removeIf | back to summary |
|---|---|
| public boolean removeIf(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 org. Doc from org. (Violation)
Remove any members of the bag that are not in the given
collection, respecting cardinality. That is, if the given
collection
The
| |
| uniqueSet | back to summary |
|---|---|
| public Set Overrides org. Implements org. Doc from org. Returns a
Uniqueness constraints are the same as those in | |
| unmodifiableBag | back to summary |
|---|---|
| public static <E> Bag Factory method to create an unmodifiable bag. If the bag passed in is already unmodifiable, it is returned.
| |
| writeObject | back to summary |
|---|---|
| private void writeObject(final ObjectOutputStream out) throws IOException Write the collection out using a custom routine.
| |