Class TransformedNavigableSet<E>

  • Type Parameters:
    E - the type of the elements in this set
    All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.NavigableSet<E>, java.util.Set<E>, java.util.SortedSet<E>

    public class TransformedNavigableSet<E>
    extends TransformedSortedSet<E>
    implements java.util.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
    See Also:
    Serialized Form
    • Method Detail

      • transformingNavigableSet

        public static <E> TransformedNavigableSet<E> transformingNavigableSet​(java.util.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:
        java.lang.NullPointerException - if set or transformer is null
      • transformedNavigableSet

        public static <E> TransformedNavigableSet<E> transformedNavigableSet​(java.util.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:
        java.lang.NullPointerException - if set or transformer is null
      • lower

        public E lower​(E e)
        Specified by:
        lower in interface java.util.NavigableSet<E>
      • floor

        public E floor​(E e)
        Specified by:
        floor in interface java.util.NavigableSet<E>
      • ceiling

        public E ceiling​(E e)
        Specified by:
        ceiling in interface java.util.NavigableSet<E>
      • higher

        public E higher​(E e)
        Specified by:
        higher in interface java.util.NavigableSet<E>
      • pollFirst

        public E pollFirst()
        Specified by:
        pollFirst in interface java.util.NavigableSet<E>
      • pollLast

        public E pollLast()
        Specified by:
        pollLast in interface java.util.NavigableSet<E>
      • descendingSet

        public java.util.NavigableSet<E> descendingSet()
        Specified by:
        descendingSet in interface java.util.NavigableSet<E>
      • descendingIterator

        public java.util.Iterator<E> descendingIterator()
        Specified by:
        descendingIterator in interface java.util.NavigableSet<E>
      • subSet

        public java.util.NavigableSet<E> subSet​(E fromElement,
                                                boolean fromInclusive,
                                                E toElement,
                                                boolean toInclusive)
        Specified by:
        subSet in interface java.util.NavigableSet<E>
      • headSet

        public java.util.NavigableSet<E> headSet​(E toElement,
                                                 boolean inclusive)
        Specified by:
        headSet in interface java.util.NavigableSet<E>
      • tailSet

        public java.util.NavigableSet<E> tailSet​(E fromElement,
                                                 boolean inclusive)
        Specified by:
        tailSet in interface java.util.NavigableSet<E>