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>
- Direct Known Subclasses:
CloseableSpliteratorMapper
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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface java.util.Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T extends Object,T_CONS extends Object,T_SPLITR extends Spliterator.OfPrimitive<T,T_CONS,T_SPLITR>>
-
-
Field Summary
Fields Modifier and Type Field Description protected Function<? super E,? extends S>
mapper
protected Spliterator<E>
spliterator
-
Fields inherited from interface java.util.Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED
-
-
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()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Spliterator
getComparator
-
-
-
-
Field Detail
-
spliterator
protected final Spliterator<E> spliterator
-
-
Constructor Detail
-
SpliteratorMapper
public SpliteratorMapper(Spliterator<E> spliterator, Function<? super E,? extends S> mapper)
-
-
Method Detail
-
tryAdvance
public boolean tryAdvance(Consumer<? super S> action)
- Specified by:
tryAdvance
in interfaceSpliterator<E>
-
trySplit
public Spliterator<S> trySplit()
- Specified by:
trySplit
in interfaceSpliterator<E>
-
estimateSize
public long estimateSize()
- Specified by:
estimateSize
in interfaceSpliterator<E>
-
characteristics
public int characteristics()
- Specified by:
characteristics
in interfaceSpliterator<E>
-
forEachRemaining
public void forEachRemaining(Consumer<? super S> action)
- Specified by:
forEachRemaining
in interfaceSpliterator<E>
-
getExactSizeIfKnown
public long getExactSizeIfKnown()
- Specified by:
getExactSizeIfKnown
in interfaceSpliterator<E>
-
hasCharacteristics
public boolean hasCharacteristics(int characteristics)
- Specified by:
hasCharacteristics
in interfaceSpliterator<E>
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseableSpliterator<E>
-
-