Class ArrayResettableIterator<E>

java.lang.Object
org.apache.activemq.artemis.utils.collections.ArrayResettableIterator<E>
All Implemented Interfaces:
Iterator<E>, ResettableIterator<E>

public class ArrayResettableIterator<E> extends Object implements ResettableIterator<E>
Provides an Array Iterator that is able to reset, allowing you to iterate over the full array. It achieves this though by moving end position mark to the the current cursors position, so it round robins, even with reset.
  • Constructor Details

    • ArrayResettableIterator

      public ArrayResettableIterator(Object[] array)
  • Method Details

    • iterator

      public static <E> ResettableIterator<E> iterator(Collection<E> collection)
    • reset

      public void reset()
      Description copied from interface: ResettableIterator
      Resets the iterator so that you can iterate over all elements from your current position. Your current position (when reached again) signals the end of iteration as if the collection is circular.
      Specified by:
      reset in interface ResettableIterator<E>
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<E>
    • next

      public E next()
      Specified by:
      next in interface Iterator<E>