Interface Spliterator.OfInt
- All Superinterfaces:
Spliterator<Integer>, Spliterator.OfPrimitive<Integer, IntConsumer, Spliterator.OfInt>
- All Known Implementing Classes:
Spliterators.AbstractIntSpliterator
- Enclosing interface:
Spliterator<T>
public static interface Spliterator.OfInt
extends Spliterator.OfPrimitive<Integer, IntConsumer, Spliterator.OfInt>
A Spliterator specialized for
int values.- Since:
- 1.8
-
Nested Class Summary
Nested classes/interfaces declared in interface Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T,T_CONS, T_SPLITR> Modifier and TypeInterfaceDescriptionstatic interfaceA Spliterator specialized fordoublevalues.static interfaceA Spliterator specialized forintvalues.static interfaceA Spliterator specialized forlongvalues.static interfaceSpliterator.OfPrimitive<T, T_CONS, T_SPLITR extends Spliterator.OfPrimitive<T,T_CONS, T_SPLITR>> A Spliterator specialized for primitive values. -
Field Summary
Fields declared in interface Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZEDModifier and TypeFieldDescriptionstatic final intCharacteristic value signifying that the element source may be safely concurrently modified (allowing additions, replacements, and/or removals) by multiple threads without external synchronization.static final intCharacteristic value signifying that, for each pair of encountered elementsx, y,!x.equals(y).static final intCharacteristic value signifying that the element source cannot be structurally modified; that is, elements cannot be added, replaced, or removed, so such changes cannot occur during traversal.static final intCharacteristic value signifying that the source guarantees that encountered elements will not benull.static final intCharacteristic value signifying that an encounter order is defined for elements.static final intCharacteristic value signifying that the value returned fromestimateSize()prior to traversal or splitting represents a finite size that, in the absence of structural source modification, represents an exact count of the number of elements that would be encountered by a complete traversal.static final intCharacteristic value signifying that encounter order follows a defined sort order.static final intCharacteristic value signifying that all Spliterators resulting fromtrySplit()will be bothSpliterator.SIZEDandSpliterator.SUBSIZED. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidforEachRemaining(Consumer<? super Integer> action) Performs the given action for each remaining element, sequentially in the current thread, until all elements have been processed or the action throws an exception.default booleantryAdvance(Consumer<? super Integer> action) If a remaining element exists: performs the given action on it, returningtrue; else returnsfalse.Methods declared in interface Spliterator
characteristics, estimateSize, getComparator, getExactSizeIfKnown, hasCharacteristics, trySplitModifier and TypeMethodDescriptionintReturns a set of characteristics of this Spliterator and its elements.longReturns an estimate of the number of elements that would be encountered by aSpliterator.forEachRemaining(Consumer)traversal, or returnsLong.MAX_VALUEif infinite, unknown, or too expensive to compute.default Comparator<? super Integer> default longConvenience method that returnsSpliterator.estimateSize()if this Spliterator isSpliterator.SIZED, else-1.default booleanhasCharacteristics(int characteristics) Returnstrueif this Spliterator'sSpliterator.characteristics()contain all of the given characteristics.trySplit()If this spliterator can be partitioned, returns a Spliterator covering elements, that will, upon return from this method, not be covered by this Spliterator.Methods declared in interface Spliterator.OfPrimitive
forEachRemaining, tryAdvanceModifier and TypeMethodDescriptiondefault voidforEachRemaining(IntConsumer action) Performs the given action for each remaining element, sequentially in the current thread, until all elements have been processed or the action throws an exception.booleantryAdvance(IntConsumer action) If a remaining element exists, performs the given action on it, returningtrue; else returnsfalse.
-
Method Details
-
tryAdvance
If a remaining element exists: performs the given action on it, returningtrue; else returnsfalse. If this Spliterator isSpliterator.ORDEREDthe action is performed on the next element in encounter order. Exceptions thrown by the action are relayed to the caller.Subsequent behavior of a spliterator is unspecified if the action throws an exception.
- Specified by:
tryAdvancein interfaceSpliterator<Integer>- Implementation Requirements:
- If the action is an instance of
IntConsumerthen it is cast toIntConsumerand passed toSpliterator.OfPrimitive.tryAdvance(java.util.function.IntConsumer); otherwise the action is adapted to an instance ofIntConsumer, by boxing the argument ofIntConsumer, and then passed toSpliterator.OfPrimitive.tryAdvance(java.util.function.IntConsumer). - Parameters:
action- The action whose operation is performed at-most once- Returns:
falseif no remaining elements existed upon entry to this method, elsetrue.
-
forEachRemaining
Performs the given action for each remaining element, sequentially in the current thread, until all elements have been processed or the action throws an exception. If this Spliterator isSpliterator.ORDERED, actions are performed in encounter order. Exceptions thrown by the action are relayed to the caller.Subsequent behavior of a spliterator is unspecified if the action throws an exception.
- Specified by:
forEachRemainingin interfaceSpliterator<Integer>- Implementation Requirements:
- If the action is an instance of
IntConsumerthen it is cast toIntConsumerand passed toSpliterator.OfPrimitive.forEachRemaining(java.util.function.IntConsumer); otherwise the action is adapted to an instance ofIntConsumer, by boxing the argument ofIntConsumer, and then passed toSpliterator.OfPrimitive.forEachRemaining(java.util.function.IntConsumer). - Parameters:
action- The action
-