Package org.apache.commons.collections4.multiset

# 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:
  - Serialized Form

- ## 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

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `TransformedSortedMultiSet(SortedMultiSet<E> multiset, Transformer<? super E,? extends E> transformer)`
  Constructor that wraps (not copies).

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Comparator<? super E>`
  `comparator()`
  Returns the comparator associated with this sorted multiset, or null if it uses its elements' natural ordering.
  `E`
  `first()`
  Returns the first (lowest) member.
  `protected SortedMultiSet<E>`
  `getSortedMultiSet()`
  Gets the decorated sorted multiset.
  `E`
  `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, uniqueSet`

  ### Methods inherited from class org.apache.commons.collections4.collection.TransformedCollection

  `add, addAll, transform, transform, transformedCollection, transformingCollection`

  ### Methods inherited from class org.apache.commons.collections4.collection.AbstractCollectionDecorator

  `clear, contains, containsAll, decorated, isEmpty, iterator, remove, removeAll, removeIf, retainAll, setCollection, size, toArray, toArray, toString`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface java.util.Collection

  `addAll, clear, contains, isEmpty, parallelStream, removeIf, spliterator, stream, toArray, toArray`

  ### Methods inherited from interface java.lang.Iterable

  `forEach`

  ### Methods inherited from interface org.apache.commons.collections4.MultiSet

  `add, add, containsAll, entrySet, equals, getCount, hashCode, iterator, remove, remove, removeAll, retainAll, setCount, size, uniqueSet`

- ## 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

    public Comparator<? super E> comparator()
    Description copied from interface: `SortedMultiSet`
    Returns the comparator associated with this sorted multiset, or null if it uses its elements' natural ordering.
    Specified by:
      `comparator` in interface `SortedMultiSet<E>`
    Returns:
      The comparator in use, or null if natural ordering.

  - ### first

    public E first()
    Description copied from interface: `SortedMultiSet`
    Returns the first (lowest) member.
    Specified by:
      `first` in interface `SortedMultiSet<E>`
    Returns:
      The first element in the sorted multiset.

  - ### getSortedMultiSet

    protected SortedMultiSet<E> getSortedMultiSet()
    Gets the decorated sorted multiset.
    Returns:
      The decorated sorted multiset.

  - ### last

    public E last()
    Description copied from interface: `SortedMultiSet`
    Returns the last (highest) member.
    Specified by:
      `last` in interface `SortedMultiSet<E>`
    Returns:
      The last element in the sorted multiset.