public interface LongIterator
extends java.util.PrimitiveIterator.OfLong
Iterator
; provides an additional method to avoid (un)boxing, and
the possibility to skip elements.Iterator
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 java.lang.Long |
next()
Deprecated.
Please use the corresponding type-specific method instead.
|
long |
nextLong()
Returns the next element as a primitive type.
|
default int |
skip(int n)
Skips the given number of elements.
|
long nextLong()
nextLong
in interface java.util.PrimitiveIterator.OfLong
Iterator.next()
@Deprecated default java.lang.Long next()
next
in interface java.util.Iterator<java.lang.Long>
next
in interface java.util.PrimitiveIterator.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.Iterator.forEachRemaining(java.util.function.Consumer)
@Deprecated default void forEachRemaining(java.util.function.Consumer<? super java.lang.Long> action)
forEachRemaining
in interface java.util.Iterator<java.lang.Long>
forEachRemaining
in interface java.util.PrimitiveIterator.OfLong
default int skip(int n)
The effect of this call is exactly the same as that of calling next()
for n
times (possibly stopping if Iterator.hasNext()
becomes false).
n
- the number of elements to skip.Iterator.next()