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>
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
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T,
T_CONS, T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>> -
Field Summary
Fields inherited from interface java.util.Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED
-
Constructor Summary
ConstructorDescriptionSpliteratorMapper
(Spliterator<E> spliterator, Function<? super E, ? extends S> mapper) -
Method Summary
Modifier and TypeMethodDescriptionint
void
close()
long
void
forEachRemaining
(Consumer<? super S> action) long
boolean
hasCharacteristics
(int characteristics) boolean
tryAdvance
(Consumer<? super S> action) 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 Details
-
spliterator
-
mapper
-
-
Constructor Details
-
SpliteratorMapper
-
-
Method Details
-
tryAdvance
- Specified by:
tryAdvance
in interfaceSpliterator<E>
-
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
- 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>
-