Interface ResetableIterator<T extends Writable>
- All Known Subinterfaces:
ResetableIterator<T>
- All Known Implementing Classes:
ArrayListBackedIterator,ArrayListBackedIterator,StreamBackedIterator,StreamBackedIterator
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 ClassesModifier and TypeInterfaceDescriptionstatic classorg.apache.hadoop.mapreduce.lib.join.ResetableIterator.EMPTY<U extends Writable> -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an element to the collection of elements to iterate over.voidclear()Close datasources, but do not release internal resources.voidclose()Close datasources and release resources.booleanhasNext()True if a call to next may return a value.booleanAssign next value to actual.booleanAssign last value returned to actual.voidreset()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
Assign next value to actual. It is required that elements added to a ResetableIterator be returned in the same order after a call toreset()(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
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 callingadd(T)to avoid a ConcurrentModificationException. -
add
Add an element to the collection of elements to iterate over.- Throws:
IOException
-
close
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.
-