## org.apache.hadoop.mapred.join
Interface ResetableIterator<T extends Writable>

All Known Implementing Classes:
  ArrayListBackedIterator, JoinRecordReader.JoinDelegationIterator, MultiFilterRecordReader.MultiFilterDelegationIterator, ResetableIterator.EMPTY, StreamBackedIterator

    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
`static class` `ResetableIterator.EMPTY<U extends Writable>`

Method Summary
`void` `add(T item)` Add an element to the collection of elements to iterate over.
`void` `clear()` Close datasources, but do not release internal resources.
`void` `close()` Close datasources and release resources.
`boolean` `hasNext()` 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` `reset()` Set iterator to return to the start of its range.

Method Detail

### 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.

Copyright © 2009 The Apache Software Foundation