# PrimitiveIterator.OfDouble

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

# OfDouble

```
interface OfDouble : PrimitiveIterator<Double!, DoubleConsumer!>
```

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

An Iterator specialized for`double`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/PrimitiveIterator.OfDouble#forEachRemaining(java.util.function.Consumer))`(`action:` `[Consumer](https://developer.android.com/reference/kotlin/java/util/function/Consumer)<in` `[Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html)!>`)` Performs the given action for each remaining element 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/PrimitiveIterator.OfDouble#forEachRemaining(java.util.function.DoubleConsumer))`(`action:` `[DoubleConsumer](https://developer.android.com/reference/kotlin/java/util/function/DoubleConsumer)!`)` Performs the given action for each remaining element until all elements have been processed or the action throws an exception.                                                                      |
| open[Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html)!    | [next](https://developer.android.com/reference/kotlin/java/util/PrimitiveIterator.OfDouble#next())`()` Returns the next element in the iteration.                                                                                                                                                                                                                                                                                                                                  |
| abstract[Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html) | [nextDouble](https://developer.android.com/reference/kotlin/java/util/PrimitiveIterator.OfDouble#nextDouble())`()` Returns the next`double`element in the iteration.                                                                                                                                                                                                                                                                                                               |

## 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 Double!>): 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](https://developer.android.com/reference/kotlin/java/util/Iterator#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](https://developer.android.com/reference/kotlin/java/util/function/Consumer)\<in[Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html)!\>:The action to be performed for each element |

|                            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: DoubleConsumer!): 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](https://developer.android.com/reference/kotlin/java/util/Iterator#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` | [DoubleConsumer](https://developer.android.com/reference/kotlin/java/util/function/DoubleConsumer)!:The action to be performed for each element |

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

### next

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

```
open fun next(): Double!
```

Returns the next element in the iteration.

|                                                        Return                                                        ||
|-----------------------------------------------------------------------------------|-----------------------------------|
| [Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html)! | the next element in the iteration |

|                                Exceptions                                 ||
|------------------------------------|---------------------------------------|
| `java.util.NoSuchElementException` | if the iteration has no more elements |

### nextDouble

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

```
abstract fun nextDouble(): Double
```

Returns the next`double`element in the iteration.

|                                                           Return                                                           ||
|----------------------------------------------------------------------------------|------------------------------------------|
| [Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html) | the next`double`element in the iteration |

|                                Exceptions                                 ||
|------------------------------------|---------------------------------------|
| `java.util.NoSuchElementException` | if the iteration has no more elements |