Package org.infinispan.commons.util
Class FilterSpliterator<T>
java.lang.Object
org.infinispan.commons.util.FilterSpliterator<T>
- All Implemented Interfaces:
AutoCloseable
,Spliterator<T>
,CloseableSpliterator<T>
Spliterator that only returns entries that pass the given predicate. This spliterator will inherit all of the
characteristics of the underlying spliterator, except that it won't return
Spliterator.SIZED
or
Spliterator.SUBSIZED
.
The forEachRemaining(Consumer)
method should provide better performance than calling
tryAdvance(Consumer)
until it returns false. This is due to having to capture the argument before testing
it and finally invoking the provided Consumer
.
- Since:
- 9.3
- 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
ConstructorDescriptionFilterSpliterator
(Spliterator<T> spliterator, Predicate<? super T> predicate) -
Method Summary
Modifier and TypeMethodDescriptionint
void
close()
long
void
forEachRemaining
(Consumer<? super T> action) boolean
tryAdvance
(Consumer<? super T> 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, getExactSizeIfKnown, hasCharacteristics
-
Constructor Details
-
FilterSpliterator
-
-
Method Details
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseableSpliterator<T>
-
tryAdvance
- Specified by:
tryAdvance
in interfaceSpliterator<T>
-
forEachRemaining
- Specified by:
forEachRemaining
in interfaceSpliterator<T>
-
trySplit
- Specified by:
trySplit
in interfaceSpliterator<T>
-
estimateSize
public long estimateSize()- Specified by:
estimateSize
in interfaceSpliterator<T>
-
characteristics
public int characteristics()- Specified by:
characteristics
in interfaceSpliterator<T>
-