Package org.infinispan.commons.util
Class SpliteratorMapper<E,S>
- java.lang.Object
-
- org.infinispan.commons.util.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
IllegalStateExceptionupon 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 java.util.function.Function<? super E,? extends S>mapperprotected java.util.Spliterator<E>spliterator
-
Constructor Summary
Constructors Constructor Description SpliteratorMapper(java.util.Spliterator<E> spliterator, java.util.function.Function<? super E,? extends S> mapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcharacteristics()voidclose()longestimateSize()voidforEachRemaining(java.util.function.Consumer<? super S> action)longgetExactSizeIfKnown()booleanhasCharacteristics(int characteristics)booleantryAdvance(java.util.function.Consumer<? super S> action)java.util.Spliterator<S>trySplit()
-
-
-
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)
-
close
public void close()
- Specified by:
closein interfaceCloseableSpliterator<E>
-
-