MultSet to provide additional behaviour.
Methods are forwarded directly to the decorated multiset.
| Modifier and Type | Field and Description |
|---|---|
| private static final long | serialVersionUID
Hides org. |
| Access | Constructor and Description |
|---|---|
| protected | |
| protected | AbstractMultiSetDecorator(final MultiSet<E>
the multiset to decorate, must not be null multiset)Constructor that wraps (not copies). |
| Modifier and Type | Method and Description |
|---|---|
| public int | add(final E
the object to add object, final int the number of occurrences to add, may be zero,
in which case no change is made to the multiset count)Implements org. |
| protected MultiSet | Returns: the decorated multisetOverrides org. |
| public Set | entrySet()
Implements org. Set of all entries contained in the MultiSet.
|
| public boolean | equals(final Object
the object to compare to object)Overrides java. Implements org. |
| public int | getCount(final Object
the object to search for object)Implements org. |
| public int | hashCode()
Overrides java. Implements org. |
| public int | remove(final Object
the object to remove object, final int the number of occurrences to remove, may be zero,
in which case no change is made to the multiset count)Implements org. |
| public int | setCount(final E
the object to update object, final int the number of occurrences of the object count)Implements org. |
| public Set | uniqueSet()
Implements org. Set of unique elements in the MultiSet.
|
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides org. Serialization version | |
| AbstractMultiSetDecorator | back to summary |
|---|---|
| protected AbstractMultiSetDecorator() Constructor only used in deserialization, do not use otherwise. | |
| AbstractMultiSetDecorator | back to summary |
|---|---|
| protected AbstractMultiSetDecorator(final MultiSet<E> multiset) Constructor that wraps (not copies).
| |
| add | back to summary |
|---|---|
| public int add(final E object, final int count) Implements org. Doc from org. Adds a number of occurrences of the specified object to the MultiSet.
If the object is already in the
| |
| decorated | back to summary |
|---|---|
| protected MultiSet Overrides org. Gets the multiset being decorated. | |
| entrySet | back to summary |
|---|---|
| public Set Implements org. Doc from org. Returns a The returned set is backed by this multiset, so any change to either is immediately reflected in the other. | |
| equals | back to summary |
|---|---|
| public boolean equals(final Object object) Overrides java. Implements org. Doc from org. Compares this MultiSet to another object. This MultiSet equals another object if it is also a MultiSet that contains the same number of occurrences of the same elements. | |
| getCount | back to summary |
|---|---|
| public int getCount(final Object object) Implements org. Doc from org. Returns the number of occurrences of the given object currently in the MultiSet. If the object does not exist in the multiset, return 0. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Implements org. Doc from org. Gets a hash code for the MultiSet compatible with the definition of equals.
The hash code is defined as the sum total of a hash code for each element.
The per element hash code is defined as
| |
| remove | back to summary |
|---|---|
| public int remove(final Object object, final int count) Implements org. Doc from org. Removes a number of occurrences of the specified object from the MultiSet. If the number of occurrences to remove is greater than the actual number of occurrences in the multiset, the object will be removed from the multiset. | |
| setCount | back to summary |
|---|---|
| public int setCount(final E object, final int count) Implements org. Doc from org. Sets the number of occurrences of the specified object in the MultiSet to the given count.
If the provided count is zero, the object will be removed from the
| |
| uniqueSet | back to summary |
|---|---|
| public Set Implements org. Doc from org. Returns a
Uniqueness constraints are the same as those in The returned set is backed by this multiset, so any change to either is immediately reflected in the other. Only removal operations are supported, in which case all occurrences of the element are removed from the backing multiset. | |