Class ArrayIterator<T>

java.lang.Object
ch.njol.util.coll.iterator.ArrayIterator<T>
All Implemented Interfaces:
com.google.common.collect.PeekingIterator<T>, Iterator<T>

public class ArrayIterator<T> extends Object implements com.google.common.collect.PeekingIterator<T>
A simple iterator to iterate over an array.
  • Constructor Details

    • ArrayIterator

      public ArrayIterator(@Nullable T[] array)
    • ArrayIterator

      public ArrayIterator(@Nullable T[] array, int start)
  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<T>
    • peek

      public T peek()
      Specified by:
      peek in interface com.google.common.collect.PeekingIterator<T>
    • next

      @Nullable public T next()
      Specified by:
      next in interface Iterator<T>
      Specified by:
      next in interface com.google.common.collect.PeekingIterator<T>
    • remove

      public void remove()
      not supported by arrays.
      Specified by:
      remove in interface Iterator<T>
      Specified by:
      remove in interface com.google.common.collect.PeekingIterator<T>
      Throws:
      UnsupportedOperationException - always