public interface LongSpliterator
extends java.util.Spliterator.OfLong
Spliterator
; provides an additional methods to avoid (un)boxing, and
the possibility to skip elements.Spliterator
Modifier and Type | Method and Description |
---|---|
default void |
forEachRemaining(java.util.function.Consumer<? super java.lang.Long> action)
Deprecated.
Please use the corresponding type-specific method instead.
|
default void |
forEachRemaining(LongConsumer action)
Performs the given action for each remaining element until all elements
have been processed or the action throws an exception.
|
default LongComparator |
getComparator() |
default long |
skip(long n)
Skips the given number of elements.
|
default boolean |
tryAdvance(java.util.function.Consumer<? super java.lang.Long> action)
Deprecated.
Please use the corresponding type-specific method instead.
|
default boolean |
tryAdvance(LongConsumer action)
Attempts to perform the action on the next element, or do nothing
but return
false if there are no remaining elements. |
LongSpliterator |
trySplit() |
@Deprecated default boolean tryAdvance(java.util.function.Consumer<? super java.lang.Long> action)
tryAdvance
in interface java.util.Spliterator<java.lang.Long>
tryAdvance
in interface java.util.Spliterator.OfLong
default boolean tryAdvance(LongConsumer action)
false
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.
action
- the action to be performed on the next element.Spliterator.tryAdvance(java.util.function.Consumer)
@Deprecated default void forEachRemaining(java.util.function.Consumer<? super java.lang.Long> action)
forEachRemaining
in interface java.util.Spliterator<java.lang.Long>
forEachRemaining
in interface java.util.Spliterator.OfLong
default void forEachRemaining(LongConsumer action)
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.
action
- the action to be performed for each element.Spliterator.forEachRemaining(java.util.function.Consumer)
default long skip(long n)
The effect of this call is exactly the same as that of calling tryAdvance(java.util.function.Consumer<? super java.lang.Long>)
for
n
times (possibly stopping if tryAdvance(java.util.function.Consumer<? super java.lang.Long>)
returns false).
The action called will do nothing; elements will be discarded.
n
- the number of elements to skip.Spliterator.tryAdvance(java.util.function.Consumer<? super T>)
LongSpliterator trySplit()
trySplit
in interface java.util.Spliterator<java.lang.Long>
trySplit
in interface java.util.Spliterator.OfLong
trySplit
in interface java.util.Spliterator.OfPrimitive<java.lang.Long,java.util.function.LongConsumer,java.util.Spliterator.OfLong>
Spliterator.trySplit()
.default LongComparator getComparator()
getComparator
in interface java.util.Spliterator<java.lang.Long>
Spliterator.getComparator()
.