public abstract class LazyIterableIterator<I,O> extends Object implements Iterable<O>, Iterator<O>
Provide a way to obtain a inputItr of type O (output), out of an inputItr of type I (input)
Things to remember: - Assumes Spark calls hasNext() to check for elements, before calling next() to obtain them - Assumes hasNext() gets called atleast once. - Concrete Implementation is responsible for calling inputIterator.next() and doing the processing in computeNext()
| Constructor and Description |
|---|
LazyIterableIterator(Iterator<I> in) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract O |
computeNext()
Block computation to be overwritten by sub classes.
|
protected abstract void |
end()
Called once, after all elements are processed.
|
boolean |
hasNext() |
Iterator<O> |
iterator() |
O |
next() |
void |
remove() |
protected abstract void |
start()
Called once, before any elements are processed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorforEachRemainingprotected abstract void start()
protected abstract O computeNext()
protected abstract void end()
Copyright © 2022 The Apache Software Foundation. All rights reserved.