Class Arrays.Iterator<T>

  • All Implemented Interfaces:
    Iterator<T>
    Enclosing class:
    Arrays

    public static class Arrays.Iterator<T>
    extends Object
    implements Iterator<T>
    Iterator backed by a specific array.
    • Constructor Detail

      • Iterator

        public Iterator​(T[] dataArray)
        Base constructor.

        Note: the array is not cloned, changes to it will affect the values returned by next().

        Parameters:
        dataArray - array backing the iterator.
    • Method Detail

      • hasNext

        public boolean hasNext()
        Description copied from interface: Iterator
        Returns true if there is at least one more element, false otherwise.
        Specified by:
        hasNext in interface Iterator<T>
        See Also:
        Iterator.next()
      • next

        public T next()
        Description copied from interface: Iterator
        Returns the next object and advances the iterator.
        Specified by:
        next in interface Iterator<T>
        Returns:
        the next object.
        See Also:
        Iterator.hasNext()
      • remove

        public void remove()
        Description copied from interface: Iterator
        Removes the last object returned by next from the collection. This method can only be called once between each call to next.
        Specified by:
        remove in interface Iterator<T>