Class TransformedSortedMultiSet<E>
java.lang.Object
org.apache.commons.collections4.collection.AbstractCollectionDecorator<E>
org.apache.commons.collections4.collection.TransformedCollection<E>
org.apache.commons.collections4.multiset.TransformedMultiSet<E>
org.apache.commons.collections4.multiset.TransformedSortedMultiSet<E>
- Type Parameters:
E- The type held in the multiset.
- All Implemented Interfaces:
Serializable,Iterable<E>,Collection<E>,MultiSet<E>,SortedMultiSet<E>
public class TransformedSortedMultiSet<E>
extends TransformedMultiSet<E>
implements SortedMultiSet<E>
Decorates another
SortedMultiSet to transform objects that are added.
The add and setCount methods are affected by this class. Thus objects must be removed or searched for using their transformed form. For example, if the transformation converts Strings to Integers, you must use the Integer form to remove objects.
- Since:
- 4.6.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.commons.collections4.MultiSet
MultiSet.Entry<E> -
Field Summary
Fields inherited from class org.apache.commons.collections4.collection.TransformedCollection
transformer -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTransformedSortedMultiSet(SortedMultiSet<E> multiset, Transformer<? super E, ? extends E> transformer) Constructor that wraps (not copies). -
Method Summary
Modifier and TypeMethodDescriptionComparator<? super E> Returns the comparator associated with this sorted multiset, or null if it uses its elements' natural ordering.first()Returns the first (lowest) member.protected SortedMultiSet<E> Gets the decorated sorted multiset.last()Returns the last (highest) member.static <E> TransformedSortedMultiSet<E> transformedSortedMultiSet(SortedMultiSet<E> multiset, Transformer<? super E, ? extends E> transformer) Factory method to create a transforming sorted multiset that will transform existing contents of the specified sorted multiset.static <E> TransformedSortedMultiSet<E> transformingSortedMultiSet(SortedMultiSet<E> multiset, Transformer<? super E, ? extends E> transformer) Factory method to create a transforming sorted multiset.Methods inherited from class org.apache.commons.collections4.multiset.TransformedMultiSet
add, entrySet, equals, getCount, getMultiSet, hashCode, remove, setCount, transformedMultiSet, transformingMultiSet, uniqueSetMethods inherited from class org.apache.commons.collections4.collection.TransformedCollection
add, addAll, transform, transform, transformedCollection, transformingCollectionMethods inherited from class org.apache.commons.collections4.collection.AbstractCollectionDecorator
clear, contains, containsAll, decorated, isEmpty, iterator, remove, removeAll, removeIf, retainAll, setCollection, size, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
addAll, clear, contains, isEmpty, parallelStream, removeIf, spliterator, stream, toArray, toArray
-
Constructor Details
-
TransformedSortedMultiSet
protected TransformedSortedMultiSet(SortedMultiSet<E> multiset, Transformer<? super E, ? extends E> transformer) Constructor that wraps (not copies).If there are any elements already in the multiset being decorated, they are NOT transformed.
- Parameters:
multiset- The multiset to decorate, must not be null.transformer- The transformer to use for conversion, must not be null.- Throws:
NullPointerException- if multiset or transformer is null.
-
-
Method Details
-
transformedSortedMultiSet
public static <E> TransformedSortedMultiSet<E> transformedSortedMultiSet(SortedMultiSet<E> multiset, Transformer<? super E, ? extends E> transformer) Factory method to create a transforming sorted multiset that will transform existing contents of the specified sorted multiset.If there are any elements already in the multiset being decorated, they will be transformed by this method. Contrast this with
transformingSortedMultiSet(SortedMultiSet, Transformer).- Type Parameters:
E- The type of the elements in the multiset.- Parameters:
multiset- The multiset to decorate, must not be null.transformer- The transformer to use for conversion, must not be null.- Returns:
- A new transformed SortedMultiSet.
- Throws:
NullPointerException- if multiset or transformer is null.
-
transformingSortedMultiSet
public static <E> TransformedSortedMultiSet<E> transformingSortedMultiSet(SortedMultiSet<E> multiset, Transformer<? super E, ? extends E> transformer) Factory method to create a transforming sorted multiset.If there are any elements already in the multiset being decorated, they are NOT transformed. Contrast this with
transformedSortedMultiSet(SortedMultiSet, Transformer).- Type Parameters:
E- The type of the elements in the multiset.- Parameters:
multiset- The multiset to decorate, must not be null.transformer- The transformer to use for conversion, must not be null.- Returns:
- A new transformed SortedMultiSet.
- Throws:
NullPointerException- if multiset or transformer is null.
-
comparator
Description copied from interface:SortedMultiSetReturns the comparator associated with this sorted multiset, or null if it uses its elements' natural ordering.- Specified by:
comparatorin interfaceSortedMultiSet<E>- Returns:
- The comparator in use, or null if natural ordering.
-
first
Description copied from interface:SortedMultiSetReturns the first (lowest) member.- Specified by:
firstin interfaceSortedMultiSet<E>- Returns:
- The first element in the sorted multiset.
-
getSortedMultiSet
Gets the decorated sorted multiset.- Returns:
- The decorated sorted multiset.
-
last
Description copied from interface:SortedMultiSetReturns the last (highest) member.- Specified by:
lastin interfaceSortedMultiSet<E>- Returns:
- The last element in the sorted multiset.
-