Package org.infinispan.commons.util
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 ofSpliterator.getComparator()
since there is no trivial way of converting this with a mapper.- Since:
- 9.0
- Author:
- wburns
-
-
Field Summary
Fields Modifier and Type Field Description protected Function<? super E,? extends S>
mapper
protected Spliterator<E>
spliterator
-
Constructor Summary
Constructors Constructor Description SpliteratorMapper(Spliterator<E> spliterator, Function<? super E,? extends S> mapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
characteristics()
void
close()
long
estimateSize()
void
forEachRemaining(Consumer<? super S> action)
long
getExactSizeIfKnown()
boolean
hasCharacteristics(int characteristics)
boolean
tryAdvance(Consumer<? super S> action)
Spliterator<S>
trySplit()
-
-
-
Field Detail
-
spliterator
protected final Spliterator<E> spliterator
-
-
Constructor Detail
-
SpliteratorMapper
public SpliteratorMapper(Spliterator<E> spliterator, Function<? super E,? extends S> mapper)
-
-
Method Detail
-
trySplit
public Spliterator<S> trySplit()
-
estimateSize
public long estimateSize()
-
characteristics
public int characteristics()
-
getExactSizeIfKnown
public long getExactSizeIfKnown()
-
hasCharacteristics
public boolean hasCharacteristics(int characteristics)
-
close
public void close()
- Specified by:
close
in interfaceCloseableSpliterator<E>
-
-