Class ArrayIterator<T>

  • Type Parameters:
    T - the array type.
    All Implemented Interfaces:
    Iterator<T>

    public abstract class ArrayIterator<T>
    extends TypeIterator<T>
    Abstract class to iterate into any array.
    Accepts any type of primitive and object array.
    • Constructor Detail

      • ArrayIterator

        public ArrayIterator​(@NotNull
                             @NotNull Object value)
        Constructs an array iterator with provided array object.
        Parameters:
        value - the array to iterate.
    • Method Detail

      • isObjectArray

        public boolean isObjectArray()
        Check if the current array iterator corresponds to an object array.
        Returns:
        true if the current array is an object array.
      • size

        public int size()
        Returns the length of the specified array object, as an int.
        Returns:
        the length of the array.
      • get

        public T get​(int index)
        Returns the value of the indexed component in the specified array object. The value is automatically wrapped in an object if it has a primitive type.
        Parameters:
        index - the index.
        Returns:
        the (possibly wrapped) value of the indexed component in the specified array.
      • hasNext

        public boolean hasNext()
      • next

        public T next()
      • remove

        public void remove()
      • remove

        public void remove​(int index)
        Remove value form array at specified index.
        Parameters:
        index - the index.