Class SpliteratorMapper<E,S>

java.lang.Object
org.infinispan.commons.util.SpliteratorMapper<E,S>
All Implemented Interfaces:
AutoCloseable, Spliterator<S>, CloseableSpliterator<S>

public class SpliteratorMapper<E,S> extends 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 Details

    • spliterator

      protected final Spliterator<E> spliterator
    • mapper

      protected final Function<? super E,? extends S> mapper
  • Constructor Details

    • SpliteratorMapper

      public SpliteratorMapper(Spliterator<E> spliterator, Function<? super E,? extends S> mapper)
  • Method Details

    • tryAdvance

      public boolean tryAdvance(Consumer<? super S> action)
    • trySplit

      public Spliterator<S> trySplit()
    • estimateSize

      public long estimateSize()
    • characteristics

      public int characteristics()
    • forEachRemaining

      public void forEachRemaining(Consumer<? super S> action)
    • getExactSizeIfKnown

      public long getExactSizeIfKnown()
    • hasCharacteristics

      public boolean hasCharacteristics(int characteristics)
    • close

      public void close()
      Specified by:
      close in interface CloseableSpliterator<E>