Interface DoubleIterator

All Superinterfaces:
java.util.Iterator<java.lang.Double>, java.util.PrimitiveIterator<java.lang.Double,​java.util.function.DoubleConsumer>, java.util.PrimitiveIterator.OfDouble
All Known Subinterfaces:
DoubleBidirectionalIterator, DoubleBigListIterator, DoubleListIterator
All Known Implementing Classes:
AbstractDoubleBidirectionalIterator, AbstractDoubleBigListIterator, AbstractDoubleIterator, AbstractDoubleListIterator, DoubleBigListIterators.AbstractIndexBasedBigIterator, DoubleBigListIterators.AbstractIndexBasedBigListIterator, DoubleBigListIterators.BigListIteratorListIterator, DoubleBigListIterators.EmptyBigListIterator, DoubleBigListIterators.UnmodifiableBigListIterator, DoubleIterators.AbstractIndexBasedIterator, DoubleIterators.AbstractIndexBasedListIterator, DoubleIterators.EmptyIterator, DoubleIterators.UnmodifiableBidirectionalIterator, DoubleIterators.UnmodifiableIterator, DoubleIterators.UnmodifiableListIterator

public interface DoubleIterator
extends java.util.PrimitiveIterator.OfDouble
A type-specific Iterator; provides an additional method to avoid (un)boxing, and the possibility to skip elements.
See Also:
Iterator
  • Nested Class Summary

    Nested classes/interfaces inherited from interface java.util.PrimitiveIterator

    java.util.PrimitiveIterator.OfDouble, java.util.PrimitiveIterator.OfInt, java.util.PrimitiveIterator.OfLong
  • Method Summary

    Modifier and Type Method Description
    default void forEachRemaining​(DoubleConsumer action)
    Performs the given action for each remaining element until all elements have been processed or the action throws an exception.
    default void forEachRemaining​(java.util.function.Consumer<? super java.lang.Double> action)
    Deprecated.
    Please use the corresponding type-specific method instead.
    default java.lang.Double next()
    Deprecated.
    Please use the corresponding type-specific method instead.
    double nextDouble()
    Returns the next element as a primitive type.
    default int skip​(int n)
    Skips the given number of elements.

    Methods inherited from interface java.util.Iterator

    hasNext, remove

    Methods inherited from interface java.util.PrimitiveIterator.OfDouble

    forEachRemaining
  • Method Details

    • nextDouble

      double nextDouble()
      Returns the next element as a primitive type.
      Specified by:
      nextDouble in interface java.util.PrimitiveIterator.OfDouble
      Returns:
      the next element in the iteration.
      See Also:
      Iterator.next()
    • next

      @Deprecated default java.lang.Double next()
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      next in interface java.util.Iterator<java.lang.Double>
      Specified by:
      next in interface java.util.PrimitiveIterator.OfDouble
    • forEachRemaining

      default void forEachRemaining​(DoubleConsumer action)
      Performs the given action for each remaining element until all elements have been processed or the action throws an exception.

      WARNING: Overriding this method is almost always a mistake, as this overload only exists to disambiguate. Instead, override the forEachRemaining() overload that uses the JDK's primitive consumer type (e.g. IntConsumer).

      If Java supported final default methods, this would be one, but sadly it does not.

      If you checked and are overriding the version with java.util.function.XConsumer, and still see this warning, then your IDE is incorrectly conflating this method with the proper method to override, and you can safely ignore this message.

      Parameters:
      action - the action to be performed for each element.
      Since:
      8.5.0
      See Also:
      Iterator.forEachRemaining(java.util.function.Consumer)
    • forEachRemaining

      @Deprecated default void forEachRemaining​(java.util.function.Consumer<? super java.lang.Double> action)
      Deprecated.
      Please use the corresponding type-specific method instead.
      Specified by:
      forEachRemaining in interface java.util.Iterator<java.lang.Double>
      Specified by:
      forEachRemaining in interface java.util.PrimitiveIterator.OfDouble
    • skip

      default int skip​(int n)
      Skips the given number of elements.

      The effect of this call is exactly the same as that of calling next() for n times (possibly stopping if Iterator.hasNext() becomes false).

      Parameters:
      n - the number of elements to skip.
      Returns:
      the number of elements actually skipped.
      See Also:
      Iterator.next()