Stay organized with collections
Save and categorize content based on your preferences.
PrimitiveIterator.OfDouble
public
static
interface
PrimitiveIterator.OfDouble
implements
PrimitiveIterator<Double, DoubleConsumer>
java.util.PrimitiveIterator.OfDouble
|
An Iterator specialized for double
values.
Summary
Inherited methods |
|
From interface
java.util.Iterator
default
void
|
forEachRemaining(Consumer<? super E> action)
Performs the given action for each remaining element until all elements
have been processed or the action throws an exception.
|
abstract
boolean
|
hasNext()
Returns true if the iteration has more elements.
|
abstract
Double
|
next()
Returns the next element in the iteration.
|
default
void
|
remove()
Removes from the underlying collection the last element returned
by this iterator (optional operation).
|
|
Public methods
forEachRemaining
public void forEachRemaining (Consumer<? super Double> action)
Implementation Requirements:
Parameters |
action |
Consumer |
forEachRemaining
public void forEachRemaining (DoubleConsumer action)
Implementation Requirements:
Parameters |
action |
DoubleConsumer |
next
public Double next ()
Returns the next element in the iteration.
Implementation Requirements:
- The default implementation boxes the result of calling
nextDouble()
, and returns that boxed result.
Returns |
Double |
the next element in the iteration |
nextDouble
public abstract double nextDouble ()
Returns the next double
element in the iteration.
Returns |
double |
the next double element in the iteration |
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.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# PrimitiveIterator.OfDouble\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nPrimitiveIterator.OfDouble\n==========================\n\n\n`\npublic\nstatic\n\n\ninterface\nPrimitiveIterator.OfDouble\n`\n\n\n`\n\n\nimplements\n\n`[PrimitiveIterator](/reference/java/util/PrimitiveIterator)`\u003c`[Double](/reference/java/lang/Double)`, `[DoubleConsumer](/reference/java/util/function/DoubleConsumer)`\u003e\n\n\n`\n\n|--------------------------------------|\n| java.util.PrimitiveIterator.OfDouble |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nAn Iterator specialized for `double` values.\n\nSummary\n-------\n\n| ### Public methods ||\n|--------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` default void` | ` `[forEachRemaining](/reference/java/util/PrimitiveIterator.OfDouble#forEachRemaining(java.util.function.Consumer\u003c?%20super%20java.lang.Double\u003e))`(`[Consumer](/reference/java/util/function/Consumer)`\u003c? super `[Double](/reference/java/lang/Double)`\u003e action) ` |\n| ` default void` | ` `[forEachRemaining](/reference/java/util/PrimitiveIterator.OfDouble#forEachRemaining(java.util.function.DoubleConsumer))`(`[DoubleConsumer](/reference/java/util/function/DoubleConsumer)` action) ` |\n| ` default `[Double](/reference/java/lang/Double) | ` `[next](/reference/java/util/PrimitiveIterator.OfDouble#next())`() ` Returns the next element in the iteration. |\n| ` abstract double` | ` `[nextDouble](/reference/java/util/PrimitiveIterator.OfDouble#nextDouble())`() ` Returns the next `double` element in the iteration. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From interface ` `[java.util.PrimitiveIterator](/reference/java/util/PrimitiveIterator)` ` |------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` `[forEachRemaining](/reference/java/util/PrimitiveIterator#forEachRemaining(T_CONS))`(`[DoubleConsumer](/reference/java/util/function/DoubleConsumer)` action) ` Performs the given action for each remaining element until all elements have been processed or the action throws an exception. | ||\n| From interface ` `[java.util.Iterator](/reference/java/util/Iterator)` ` |---------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` default void` | ` `[forEachRemaining](/reference/java/util/Iterator#forEachRemaining(java.util.function.Consumer\u003c?%20super%20E\u003e))`(`[Consumer](/reference/java/util/function/Consumer)`\u003c? super E\u003e action) ` Performs the given action for each remaining element until all elements have been processed or the action throws an exception. | | ` abstract boolean` | ` `[hasNext](/reference/java/util/Iterator#hasNext())`() ` Returns `true` if the iteration has more elements. | | ` abstract `[Double](/reference/java/lang/Double) | ` `[next](/reference/java/util/Iterator#next())`() ` Returns the next element in the iteration. | | ` default void` | ` `[remove](/reference/java/util/Iterator#remove())`() ` Removes from the underlying collection the last element returned by this iterator (optional operation). | ||\n\nPublic methods\n--------------\n\n### forEachRemaining\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic void forEachRemaining (Consumer\u003c? super Double\u003e action)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n##### Implementation Requirements:\n\n- If the action is an instance of `DoubleConsumer` then it is cast to `DoubleConsumer` and passed to [PrimitiveIterator.forEachRemaining(T_CONS)](/reference/java/util/PrimitiveIterator#forEachRemaining(T_CONS)); otherwise the action is adapted to an instance of `DoubleConsumer`, by boxing the argument of `DoubleConsumer`, and then passed to [PrimitiveIterator.forEachRemaining(T_CONS)](/reference/java/util/PrimitiveIterator#forEachRemaining(T_CONS)).\n\n| Parameters ||\n|----------|-------------------|\n| `action` | `Consumer` \u003cbr /\u003e |\n\n### forEachRemaining\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic void forEachRemaining (DoubleConsumer action)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n##### Implementation Requirements:\n\n- The default implementation behaves as if:\n\n while (hasNext())\n action.accept(nextDouble());\n \n| Parameters ||\n|----------|-------------------------|\n| `action` | `DoubleConsumer` \u003cbr /\u003e |\n\n### next\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic Double next ()\n```\n\nReturns the next element in the iteration.\n\n\u003cbr /\u003e\n\n##### Implementation Requirements:\n\n- The default implementation boxes the result of calling [nextDouble()](/reference/java/util/PrimitiveIterator.OfDouble#nextDouble()), and returns that boxed result.\n\n| Returns ||\n|---------------------------------------|------------------------------------------|\n| [Double](/reference/java/lang/Double) | the next element in the iteration \u003cbr /\u003e |\n\n### nextDouble\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract double nextDouble ()\n```\n\nReturns the next `double` element in the iteration.\n\n\u003cbr /\u003e\n\n| Returns ||\n|----------|---------------------------------------------------|\n| `double` | the next `double` element in the iteration \u003cbr /\u003e |\n\n| Throws ||\n|-----------------------------------------------------------------------|---------------------------------------|\n| [NoSuchElementException](/reference/java/util/NoSuchElementException) | if the iteration has no more elements |"]]