public class BrowseIterator
extends Object
Iterator to browse all index content.
This helper takes care of chaining API requests and calling back the handler block with the results, until: - the end of the index has been reached; - an error has been encountered; - or the user cancelled the iteration.
| Modifier and Type | Class and Description |
|---|---|
static interface |
BrowseIterator.BrowseIteratorHandler
Listener for
BrowseIterator. |
| Constructor and Description |
|---|
BrowseIterator(Index index,
Query query,
BrowseIterator.BrowseIteratorHandler handler)
Construct a new browse iterator.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancel the iteration.
|
boolean |
hasNext()
Determine if there is more content to be browsed.
|
void |
start()
Start the iteration.
|
public BrowseIterator(@NonNull
Index index,
@NonNull
Query query,
@NonNull
BrowseIterator.BrowseIteratorHandler handler)
Construct a new browse iterator. NOTE: The iteration does not start automatically. You have to call start() explicitly.
index - The index to be browsed.query - The query used to filter the results.handler - Handler called for each batch of results.public void start()
Start the iteration.
public void cancel()
Cancel the iteration. This cancels any currently ongoing request, and cancels the iteration. The listener will not be called after the iteration has been cancelled.
public boolean hasNext()
Determine if there is more content to be browsed. WARNING: Can only be called from the handler, once the iteration has started.