Stay organized with collections
Save and categorize content based on your preferences.
OfInt
interface OfInt : PrimitiveIterator<Int!, IntConsumer!>
An Iterator specialized for int
values.
Summary
Public methods |
open Unit |
Performs the given action for each remaining element until all elements have been processed or the action throws an exception.
|
open Unit |
Performs the given action for each remaining element until all elements have been processed or the action throws an exception.
|
open Int! |
Returns the next element in the iteration.
|
abstract Int |
Returns the next int element in the iteration.
|
Public methods
forEachRemaining
open fun forEachRemaining(action: Consumer<in Int!>): 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
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 Int!>: The action to be performed for each element |
Exceptions |
java.lang.NullPointerException |
if the specified action is null |
forEachRemaining
open fun forEachRemaining(action: IntConsumer!): 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
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 |
IntConsumer!: The action to be performed for each element |
Exceptions |
java.lang.NullPointerException |
if the specified action is null |
next
open fun next(): Int!
Returns the next element in the iteration.
Return |
Int! |
the next element in the iteration |
Exceptions |
java.util.NoSuchElementException |
if the iteration has no more elements |
nextInt
abstract fun nextInt(): Int
Returns the next int
element in the iteration.
Return |
Int |
the next int 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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# PrimitiveIterator.OfInt\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nOfInt\n=====\n\n```\ninterface OfInt : PrimitiveIterator\u003cInt!, IntConsumer!\u003e\n```\n\n|----------------------------------------|\n| [java.util.PrimitiveIterator.OfInt](#) |\n\nAn Iterator specialized for `int` values.\n\nSummary\n-------\n\n| Public methods ||\n|-------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [forEachRemaining](#forEachRemaining(java.util.function.Consumer))`(`action:` `[Consumer](/reference/kotlin/java/util/function/Consumer)\u003cin` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\u003e`)` Performs the given action for each remaining element until all elements have been processed or the action throws an exception. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [forEachRemaining](#forEachRemaining(java.util.function.IntConsumer))`(`action:` `[IntConsumer](/reference/kotlin/java/util/function/IntConsumer)!`)` Performs the given action for each remaining element until all elements have been processed or the action throws an exception. |\n| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)! | [next](#next())`()` Returns the next element in the iteration. |\n| abstract [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [nextInt](#nextInt())`()` Returns the next `int` element in the iteration. |\n\nPublic methods\n--------------\n\n### forEachRemaining\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun forEachRemaining(action: Consumer\u003cin Int!\u003e): Unit\n```\n\nPerforms 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.\n\nThe 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()) method or other mutator methods of `Iterator` subtypes), unless an overriding class has specified a concurrent modification policy.\n\nSubsequent behavior of an iterator is unspecified if the action throws an exception.\n\n| Parameters ||\n|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `action` | [Consumer](/reference/kotlin/java/util/function/Consumer)\\\u003cin [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\\\u003e: The action to be performed for each element |\n\n| Exceptions ||\n|----------------------------------|---------------------------------|\n| `java.lang.NullPointerException` | if the specified action is null |\n\n### forEachRemaining\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun forEachRemaining(action: IntConsumer!): Unit\n```\n\nPerforms 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.\n\nThe 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()) method or other mutator methods of `Iterator` subtypes), unless an overriding class has specified a concurrent modification policy.\n\nSubsequent behavior of an iterator is unspecified if the action throws an exception.\n\n| Parameters ||\n|----------|---------------------------------------------------------------------------------------------------------------|\n| `action` | [IntConsumer](/reference/kotlin/java/util/function/IntConsumer)!: The action to be performed for each element |\n\n| Exceptions ||\n|----------------------------------|---------------------------------|\n| `java.lang.NullPointerException` | if the specified action is null |\n\n### next\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun next(): Int!\n```\n\nReturns the next element in the iteration.\n\n| Return ||\n|-----------------------------------------------------------------------------|-----------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)! | the next element in the iteration |\n\n| Exceptions ||\n|------------------------------------|---------------------------------------|\n| `java.util.NoSuchElementException` | if the iteration has no more elements |\n\n### nextInt\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun nextInt(): Int\n```\n\nReturns the next `int` element in the iteration.\n\n| Return ||\n|----------------------------------------------------------------------------|-----------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | the next `int` element in the iteration |\n\n| Exceptions ||\n|------------------------------------|---------------------------------------|\n| `java.util.NoSuchElementException` | if the iteration has no more elements |"]]