Package org.infinispan.commons.util
Class FilterSpliterator<T>
- java.lang.Object
-
- org.infinispan.commons.util.FilterSpliterator<T>
-
- All Implemented Interfaces:
java.lang.AutoCloseable,java.util.Spliterator<T>,CloseableSpliterator<T>
public class FilterSpliterator<T> extends java.lang.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
-
-
Constructor Summary
Constructors Constructor Description FilterSpliterator(java.util.Spliterator<T> spliterator, java.util.function.Predicate<? super T> predicate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcharacteristics()voidclose()longestimateSize()voidforEachRemaining(java.util.function.Consumer<? super T> action)booleantryAdvance(java.util.function.Consumer<? super T> action)java.util.Spliterator<T>trySplit()
-
-
-
Method Detail
-
close
public void close()
- Specified by:
closein interfaceCloseableSpliterator<T>
-
tryAdvance
public boolean tryAdvance(java.util.function.Consumer<? super T> action)
-
forEachRemaining
public void forEachRemaining(java.util.function.Consumer<? super T> action)
-
trySplit
public java.util.Spliterator<T> trySplit()
-
estimateSize
public long estimateSize()
-
characteristics
public int characteristics()
-
-