Interface ResetableIterator<T extends Writable>

All Known Subinterfaces:
ResetableIterator<T>
All Known Implementing Classes:
ArrayListBackedIterator, ArrayListBackedIterator, StreamBackedIterator, StreamBackedIterator

@Public @Stable public interface ResetableIterator<T extends Writable>
This defines an interface to a stateful Iterator that can replay elements added to it directly. Note that this does not extend Iterator.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    org.apache.hadoop.mapreduce.lib.join.ResetableIterator.EMPTY<U extends Writable>
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(T item)
    Add an element to the collection of elements to iterate over.
    void
    Close datasources, but do not release internal resources.
    void
    Close datasources and release resources.
    boolean
    True if a call to next may return a value.
    boolean
    next(T val)
    Assign next value to actual.
    boolean
    replay(T val)
    Assign last value returned to actual.
    void
    Set iterator to return to the start of its range.
  • Method Details

    • hasNext

      boolean hasNext()
      True if a call to next may return a value. This is permitted false positives, but not false negatives.
    • next

      boolean next(T val) throws IOException
      Assign next value to actual. It is required that elements added to a ResetableIterator be returned in the same order after a call to reset() (FIFO). Note that a call to this may fail for nested joins (i.e. more elements available, but none satisfying the constraints of the join)
      Throws:
      IOException
    • replay

      boolean replay(T val) throws IOException
      Assign last value returned to actual.
      Throws:
      IOException
    • reset

      void reset()
      Set iterator to return to the start of its range. Must be called after calling add(T) to avoid a ConcurrentModificationException.
    • add

      void add(T item) throws IOException
      Add an element to the collection of elements to iterate over.
      Throws:
      IOException
    • close

      void close() throws IOException
      Close datasources and release resources. Calling methods on the iterator after calling close has undefined behavior.
      Throws:
      IOException
    • clear

      void clear()
      Close datasources, but do not release internal resources. Calling this method should permit the object to be reused with a different datasource.