Interface DoubleSpliterator
- All Superinterfaces:
Spliterator<Double>
,Spliterator.OfDouble
,Spliterator.OfPrimitive<Double,
DoubleConsumer, Spliterator.OfDouble>
- All Known Implementing Classes:
AbstractDoubleSpliterator
,DoubleBigSpliterators.AbstractIndexBasedSpliterator
,DoubleBigSpliterators.EarlyBindingSizeIndexBasedSpliterator
,DoubleBigSpliterators.LateBindingSizeIndexBasedSpliterator
,DoubleSpliterators.AbstractIndexBasedSpliterator
,DoubleSpliterators.EarlyBindingSizeIndexBasedSpliterator
,DoubleSpliterators.EmptySpliterator
,DoubleSpliterators.LateBindingSizeIndexBasedSpliterator
Spliterator
; provides an additional methods to avoid (un)boxing, and the
possibility to skip elements.- Since:
- 8.5.0
- Author:
- C. Sean Young <csyoung@google.com>
- See Also:
-
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
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
forEachRemaining
(DoubleConsumer action) Performs the given action for each remaining element until all elements have been processed or the action throws an exception.default void
forEachRemaining
(Consumer<? super Double> action) Deprecated.Please use the corresponding type-specific method instead.default DoubleComparator
default long
skip
(long n) Skips the given number of elements.default boolean
tryAdvance
(DoubleConsumer action) Attempts to perform the action on the next element, or do nothing but returnfalse
if there are no remaining elements.default boolean
tryAdvance
(Consumer<? super Double> action) Deprecated.Please use the corresponding type-specific method instead.trySplit()
Methods inherited from interface java.util.Spliterator
characteristics, estimateSize, getExactSizeIfKnown, hasCharacteristics
Methods inherited from interface java.util.Spliterator.OfDouble
forEachRemaining, tryAdvance
-
Method Details
-
tryAdvance
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
tryAdvance
in interfaceSpliterator<Double>
- Specified by:
tryAdvance
in interfaceSpliterator.OfDouble
-
tryAdvance
Attempts to perform the action on the next element, or do nothing but returnfalse
if there are no remaining elements.WARNING: Overriding this method is almost always a mistake, as this overload only exists to disambiguate. Instead, override the
tryAdvance()
overload that uses the JDK's primitive consumer type (e.g.,IntConsumer
).
If Java supported final default methods, this would be one, but sadly it does not.If you checked and are overriding the version with
java.util.function.XConsumer
, and still see this warning, then your IDE is incorrectly conflating this method with the proper method to override, and you can safely ignore this message.- Parameters:
action
- the action to be performed on the next element.- Returns:
- whether there was a next element the action was performed on
- See Also:
-
forEachRemaining
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
forEachRemaining
in interfaceSpliterator<Double>
- Specified by:
forEachRemaining
in interfaceSpliterator.OfDouble
-
forEachRemaining
Performs the given action for each remaining element until all elements have been processed or the action throws an exception.WARNING: Overriding this method is almost always a mistake, as this overload only exists to disambiguate. Instead, override the
forEachRemaining()
overload that uses the JDK's primitive consumer type (e.g.IntConsumer
).If Java supported final default methods, this would be one, but sadly it does not.
If you checked and are overriding the version with
java.util.function.XConsumer
, and still see this warning, then your IDE is incorrectly conflating this method with the proper method to override, and you can safely ignore this message.- Parameters:
action
- the action to be performed for each element.- See Also:
-
skip
default long skip(long n) Skips the given number of elements.The effect of this call is exactly the same as that of calling
tryAdvance(java.util.function.Consumer<? super java.lang.Double>)
forn
times (possibly stopping iftryAdvance(java.util.function.Consumer<? super java.lang.Double>)
returns false). The action called will do nothing; elements will be discarded.- Parameters:
n
- the number of elements to skip.- Returns:
- the number of elements actually skipped.
- See Also:
- Implementation Specification:
- This default implementation is linear in n. It is expected concrete implementations that are capable of it will override it to run lower time, but be prepared for linear time.
-
trySplit
DoubleSpliterator trySplit()- Specified by:
trySplit
in interfaceSpliterator<Double>
- Specified by:
trySplit
in interfaceSpliterator.OfDouble
- Specified by:
trySplit
in interfaceSpliterator.OfPrimitive<Double,
DoubleConsumer, Spliterator.OfDouble> - API Notes:
- Note that this specification strengthens the one given in
Spliterator.trySplit()
.
-
getComparator
- Specified by:
getComparator
in interfaceSpliterator<Double>
- API Notes:
- Note that this specification strengthens the one given in
Spliterator.getComparator()
.
-