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>
public class FilterSpliterator<T> extends Object implements 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 returnSpliterator.SIZEDorSpliterator.SUBSIZED.The
forEachRemaining(Consumer)method should provide better performance than callingtryAdvance(Consumer)until it returns false. This is due to having to capture the argument before testing it and finally invoking the providedConsumer.- 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 extends Object,T_CONS extends Object,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
Constructors Constructor Description FilterSpliterator(Spliterator<T> spliterator, Predicate<? super T> predicate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcharacteristics()voidclose()longestimateSize()voidforEachRemaining(Consumer<? super T> action)booleantryAdvance(Consumer<? super T> action)Spliterator<T>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 Detail
-
FilterSpliterator
public FilterSpliterator(Spliterator<T> spliterator, Predicate<? super T> predicate)
-
-
Method Detail
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseableSpliterator<T>
-
tryAdvance
public boolean tryAdvance(Consumer<? super T> action)
- Specified by:
tryAdvancein interfaceSpliterator<T>
-
forEachRemaining
public void forEachRemaining(Consumer<? super T> action)
- Specified by:
forEachRemainingin interfaceSpliterator<T>
-
trySplit
public Spliterator<T> trySplit()
- Specified by:
trySplitin interfaceSpliterator<T>
-
estimateSize
public long estimateSize()
- Specified by:
estimateSizein interfaceSpliterator<T>
-
characteristics
public int characteristics()
- Specified by:
characteristicsin interfaceSpliterator<T>
-
-