org.apache.commons.collections4.set

## Class TransformedNavigableSet<E>

- java.lang.Object
- - org.apache.commons.collections4.collection.AbstractCollectionDecorator<E>
  - - org.apache.commons.collections4.collection.TransformedCollection<E>
    - - org.apache.commons.collections4.set.TransformedSet<E>
      - - org.apache.commons.collections4.set.TransformedSortedSet<E>
        - - org.apache.commons.collections4.set.TransformedNavigableSet<E>

- All Implemented Interfaces:
    Serializable, Iterable<E>, Collection<E>, NavigableSet<E>, Set<E>, SortedSet<E>

      public class TransformedNavigableSet<E>
      extends TransformedSortedSet<E>
      implements NavigableSet<E>

  Decorates another `NavigableSet` to transform objects that are added.

  The add 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.1
  Version:
    $Id: TransformedNavigableSet.java 1686855 2015-06-22 13:00:27Z tn $
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.apache.commons.collections4.collection.TransformedCollection

      `transformer`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `TransformedNavigableSet(NavigableSet<E> set, Transformer<? super E,? extends E> transformer)` Constructor that wraps (not copies).

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `E` | `ceiling(E e)`
    `protected NavigableSet<E>` | `decorated()` Gets the decorated navigable set.
    `Iterator<E>` | `descendingIterator()`
    `NavigableSet<E>` | `descendingSet()`
    `E` | `floor(E e)`
    `NavigableSet<E>` | `headSet(E toElement, boolean inclusive)`
    `E` | `higher(E e)`
    `E` | `lower(E e)`
    `E` | `pollFirst()`
    `E` | `pollLast()`
    `NavigableSet<E>` | `subSet(E fromElement, boolean fromInclusive, E toElement, boolean toInclusive)`
    `NavigableSet<E>` | `tailSet(E fromElement, boolean inclusive)`
    `static <E> TransformedNavigableSet<E>` | `transformedNavigableSet(NavigableSet<E> set, Transformer<? super E,? extends E> transformer)` Factory method to create a transforming navigable set that will transform existing contents of the specified navigable set.
    `static <E> TransformedNavigableSet<E>` | `transformingNavigableSet(NavigableSet<E> set, Transformer<? super E,? extends E> transformer)` Factory method to create a transforming navigable set.

    - ### Methods inherited from class org.apache.commons.collections4.set.TransformedSortedSet

      `comparator, first, getSortedSet, headSet, last, subSet, tailSet, transformedSortedSet, transformingSortedSet`

    - ### Methods inherited from class org.apache.commons.collections4.set.TransformedSet

      `equals, hashCode, transformedSet, transformingSet`

    - ### 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, isEmpty, iterator, remove, removeAll, 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.NavigableSet

      `headSet, iterator, subSet, tailSet`

    - ### Methods inherited from interface java.util.SortedSet

      `comparator, first, last`

    - ### Methods inherited from interface java.util.Set

      `add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, size, toArray, toArray`

- - ### Constructor Detail

    - #### TransformedNavigableSet

          protected TransformedNavigableSet(NavigableSet<E> set,
                                 Transformer<? super E,? extends E> transformer)

      Constructor that wraps (not copies).

      If there are any elements already in the set being decorated, they are NOT transformed.

      Parameters:
        `set` - the set to decorate, must not be null
        `transformer` - the transformer to use for conversion, must not be null
      Throws:
        `NullPointerException` - if set or transformer is null

  - ### Method Detail

    - #### transformingNavigableSet

          public static <E> TransformedNavigableSet<E> transformingNavigableSet(NavigableSet<E> set,
                                                                Transformer<? super E,? extends E> transformer)

      Factory method to create a transforming navigable set.

      If there are any elements already in the set being decorated, they are NOT transformed. Contrast this with `transformedNavigableSet(NavigableSet, Transformer)`.

      Type Parameters:
        `E` - the element type
      Parameters:
        `set` - the set to decorate, must not be null
        `transformer` - the transformer to use for conversion, must not be null
      Returns:
        a new transformed `NavigableSet`
      Throws:
        `NullPointerException` - if set or transformer is null

    - #### transformedNavigableSet

          public static <E> TransformedNavigableSet<E> transformedNavigableSet(NavigableSet<E> set,
                                                               Transformer<? super E,? extends E> transformer)

      Factory method to create a transforming navigable set that will transform existing contents of the specified navigable set.

      If there are any elements already in the set being decorated, they will be transformed by this method. Contrast this with `transformingNavigableSet(NavigableSet, Transformer)`.

      Type Parameters:
        `E` - the element type
      Parameters:
        `set` - the set to decorate, must not be null
        `transformer` - the transformer to use for conversion, must not be null
      Returns:
        a new transformed `NavigableSet`
      Throws:
        `NullPointerException` - if set or transformer is null

    - #### decorated

          protected NavigableSet<E> decorated()

      Gets the decorated navigable set.
      Overrides:
        `decorated` in class `AbstractCollectionDecorator<E>`
      Returns:
        the decorated navigable set

    - #### lower

          public E lower(E e)

      Specified by:
        `lower` in interface `NavigableSet<E>`

    - #### floor

          public E floor(E e)

      Specified by:
        `floor` in interface `NavigableSet<E>`

    - #### ceiling

          public E ceiling(E e)

      Specified by:
        `ceiling` in interface `NavigableSet<E>`

    - #### higher

          public E higher(E e)

      Specified by:
        `higher` in interface `NavigableSet<E>`

    - #### pollFirst

          public E pollFirst()

      Specified by:
        `pollFirst` in interface `NavigableSet<E>`

    - #### pollLast

          public E pollLast()

      Specified by:
        `pollLast` in interface `NavigableSet<E>`

    - #### descendingSet

          public NavigableSet<E> descendingSet()

      Specified by:
        `descendingSet` in interface `NavigableSet<E>`

    - #### descendingIterator

          public Iterator<E> descendingIterator()

      Specified by:
        `descendingIterator` in interface `NavigableSet<E>`

    - #### subSet

          public NavigableSet<E> subSet(E fromElement,
                               boolean fromInclusive,
                               E toElement,
                               boolean toInclusive)

      Specified by:
        `subSet` in interface `NavigableSet<E>`

    - #### headSet

          public NavigableSet<E> headSet(E toElement,
                                boolean inclusive)

      Specified by:
        `headSet` in interface `NavigableSet<E>`

    - #### tailSet

          public NavigableSet<E> tailSet(E fromElement,
                                boolean inclusive)

      Specified by:
        `tailSet` in interface `NavigableSet<E>`

Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.