Class SpliteratorMapper<E,​S>

  • All Implemented Interfaces:
    java.lang.AutoCloseable, java.util.Spliterator<S>, CloseableSpliterator<S>
    Direct Known Subclasses:
    CloseableSpliteratorMapper

    public class SpliteratorMapper<E,​S>
    extends java.lang.Object
    implements CloseableSpliterator<S>
    A spliterator that has been mapped from another spliterator. This is nice to only lazily convert these values, so that you can convert across multiple threads or if the entire spliterator is not consumed.

    This spliterator will always throw an IllegalStateException upon invocation of Spliterator.getComparator() since there is no trivial way of converting this with a mapper.

    Since:
    9.0
    Author:
    wburns
    • Field Detail

      • spliterator

        protected final java.util.Spliterator<E> spliterator
      • mapper

        protected final java.util.function.Function<? super E,​? extends S> mapper
    • Constructor Detail

      • SpliteratorMapper

        public SpliteratorMapper​(java.util.Spliterator<E> spliterator,
                                 java.util.function.Function<? super E,​? extends S> mapper)
    • Method Detail

      • tryAdvance

        public boolean tryAdvance​(java.util.function.Consumer<? super S> action)
      • trySplit

        public java.util.Spliterator<S> trySplit()
      • estimateSize

        public long estimateSize()
      • characteristics

        public int characteristics()
      • forEachRemaining

        public void forEachRemaining​(java.util.function.Consumer<? super S> action)
      • getExactSizeIfKnown

        public long getExactSizeIfKnown()
      • hasCharacteristics

        public boolean hasCharacteristics​(int characteristics)