# Spliterator.OfInt

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# OfInt

```
interface OfInt : Spliterator.OfPrimitive<Int!, IntConsumer!, Spliterator.OfInt!>
```

|------------------------------------------------------------------------------------------------------------|
| [java.util.Spliterator.OfInt](https://developer.android.com/reference/kotlin/java/util/Spliterator.OfInt#) |

|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Direct Subclasses [Spliterators.AbstractIntSpliterator](https://developer.android.com/reference/kotlin/java/util/Spliterators.AbstractIntSpliterator) |-------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------| | [Spliterators.AbstractIntSpliterator](https://developer.android.com/reference/kotlin/java/util/Spliterators.AbstractIntSpliterator) | An abstract`Spliterator.OfInt`that implements`trySplit`to permit limited parallelism. | |

A Spliterator specialized for`int`values.

## Summary

|                                                                                                                                                                                                                                                                                                    Public methods                                                                                                                                                                                                                                                                                                    ||
|-----------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                          | [forEachRemaining](https://developer.android.com/reference/kotlin/java/util/Spliterator.OfInt#forEachRemaining(java.util.function.Consumer))`(`action:` `[Consumer](https://developer.android.com/reference/kotlin/java/util/function/Consumer)<in` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!>!`)` Performs the given action for each remaining element, sequentially in the current thread, until all elements have been processed or the action throws an exception. |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                          | [forEachRemaining](https://developer.android.com/reference/kotlin/java/util/Spliterator.OfInt#forEachRemaining(java.util.function.IntConsumer))`(`action:` `[IntConsumer](https://developer.android.com/reference/kotlin/java/util/function/IntConsumer)!`)` <br />                                                                                                                                                                                                                                       |
| open[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                    | [tryAdvance](https://developer.android.com/reference/kotlin/java/util/Spliterator.OfInt#tryAdvance(java.util.function.Consumer))`(`action:` `[Consumer](https://developer.android.com/reference/kotlin/java/util/function/Consumer)<in` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!>!`)` If a remaining element exists: performs the given action on it, returning`true`; else returns`false`.                                                                           |
| abstract[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                | [tryAdvance](https://developer.android.com/reference/kotlin/java/util/Spliterator.OfInt#tryAdvance(java.util.function.IntConsumer))`(`action:` `[IntConsumer](https://developer.android.com/reference/kotlin/java/util/function/IntConsumer)!`)` <br />                                                                                                                                                                                                                                                   |
| abstract[Spliterator.OfInt](https://developer.android.com/reference/kotlin/java/util/Spliterator.OfInt#)! | [trySplit](https://developer.android.com/reference/kotlin/java/util/Spliterator.OfInt#trySplit())`()` <br />                                                                                                                                                                                                                                                                                                                                                                                              |

## Public methods

### forEachRemaining

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

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

Performs the given action for each remaining element, sequentially in the current thread, until all elements have been processed or the action throws an exception. If this Spliterator is[ORDERED](https://developer.android.com/reference/kotlin/java/util/Spliterator#ORDERED:kotlin.Int), actions are performed in encounter order. Exceptions thrown by the action are relayed to the caller.

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

|                                                                                          Parameters                                                                                           ||
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `action` | [Consumer](https://developer.android.com/reference/kotlin/java/util/function/Consumer)\<in[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\>!:The action |

|                            Exceptions                             ||
|----------------------------------|---------------------------------|
| `java.lang.NullPointerException` | if the specified action is null |

### forEachRemaining

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun forEachRemaining(action: IntConsumer!): Unit
```

|                                                     Parameters                                                     ||
|----------|----------------------------------------------------------------------------------------------------------|
| `action` | [IntConsumer](https://developer.android.com/reference/kotlin/java/util/function/IntConsumer)!:The action |

|                            Exceptions                             ||
|----------------------------------|---------------------------------|
| `java.lang.NullPointerException` | if the specified action is null |

### tryAdvance

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun tryAdvance(action: Consumer<in Int!>!): Boolean
```

If a remaining element exists: performs the given action on it, returning`true`; else returns`false`. If this Spliterator is[ORDERED](https://developer.android.com/reference/kotlin/java/util/Spliterator#ORDERED:kotlin.Int)the action is performed on the next element in encounter order. Exceptions thrown by the action are relayed to the caller.

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

|                                                                                                               Parameters                                                                                                                ||
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `action` | [Consumer](https://developer.android.com/reference/kotlin/java/util/function/Consumer)\<in[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\>!:The action whose operation is performed at-most once |

|                                                                               Return                                                                               ||
|------------------------------------------------------------------------------------|--------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `false`if no remaining elements existed upon entry to this method, else`true`. |

|                            Exceptions                             ||
|----------------------------------|---------------------------------|
| `java.lang.NullPointerException` | if the specified action is null |

### tryAdvance

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
abstract fun tryAdvance(action: IntConsumer!): Boolean
```

|                                                     Parameters                                                     ||
|----------|----------------------------------------------------------------------------------------------------------|
| `action` | [IntConsumer](https://developer.android.com/reference/kotlin/java/util/function/IntConsumer)!:The action |

|                                                                               Return                                                                               ||
|------------------------------------------------------------------------------------|--------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `false`if no remaining elements existed upon entry to this method, else`true`. |

|                            Exceptions                             ||
|----------------------------------|---------------------------------|
| `java.lang.NullPointerException` | if the specified action is null |

### trySplit

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
abstract fun trySplit(): Spliterator.OfInt!
```

|                                                                                               Return                                                                                                ||
|---------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|
| [Spliterator.OfInt](https://developer.android.com/reference/kotlin/java/util/Spliterator.OfInt#)! | a`Spliterator`covering some portion of the elements, or`null`if this spliterator cannot be split |