PrimitiveIterator.OfLong  |  API reference  |  Android Developers (original) (raw)

interface OfLong : PrimitiveIterator<Long!, LongConsumer!>

An Iterator specialized for long values.

Summary

Public methods
open Unit forEachRemaining(action: Consumer<in Long!>) Performs the given action for each remaining element until all elements have been processed or the action throws an exception.
open Unit forEachRemaining(action: LongConsumer!) Performs the given action for each remaining element until all elements have been processed or the action throws an exception.
open Long! next() Returns the next element in the iteration.
abstract Long nextLong() Returns the next long element in the iteration.

Public methods

forEachRemaining

open fun forEachRemaining(action: Consumer<in Long!>): Unit

Performs the given action for each remaining element until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller.

The behavior of an iterator is unspecified if the action modifies the collection in any way (even by calling the [remove](/reference/kotlin/java/util/Iterator#remove%28%29) method or other mutator methods of Iterator subtypes), unless an overriding class has specified a concurrent modification policy.

Subsequent behavior of an iterator is unspecified if the action throws an exception.

Parameters
action Consumer<in Long!>: The action to be performed for each element
Exceptions
java.lang.NullPointerException if the specified action is null

forEachRemaining

open fun forEachRemaining(action: LongConsumer!): Unit

Performs the given action for each remaining element until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller.

The behavior of an iterator is unspecified if the action modifies the source of elements in any way (even by calling the [remove](/reference/kotlin/java/util/Iterator#remove%28%29) method or other mutator methods of Iterator subtypes), unless an overriding class has specified a concurrent modification policy.

Subsequent behavior of an iterator is unspecified if the action throws an exception.

Parameters
action LongConsumer!: The action to be performed for each element
Exceptions
java.lang.NullPointerException if the specified action is null

next

open fun next(): Long!

Returns the next element in the iteration.

Return
Long! the next element in the iteration
Exceptions
java.util.NoSuchElementException if the iteration has no more elements

nextLong

abstract fun nextLong(): Long

Returns the next long element in the iteration.

Return
Long the next long element in the iteration
Exceptions
java.util.NoSuchElementException if the iteration has no more elements

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2025-02-10 UTC.