Package com.datastax.astra.client.model
Class FindIterator<T>
java.lang.Object
com.datastax.astra.client.model.FindIterator<T>
- Type Parameters:
T
- working document
- All Implemented Interfaces:
Iterator<T>
Implementing a custom iterator that will load next page if needed when hitting the last item of page.
-
Constructor Summary
ConstructorDescriptionFindIterator
(PageableIterable<T> findIterable) Starting the cursor on an iterable to fetch more pages. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Constructor Details
-
FindIterator
Starting the cursor on an iterable to fetch more pages.- Parameters:
findIterable
- iterable
-
-
Method Details
-
hasNext
public boolean hasNext() -
next
Implementing a logic of iterator combining current page and paging. An local iterator is started on elements of the processing page. If the local iterator is exhausted, the flag 'nextPageState' can tell us is there are more elements to retrieve. if 'nextPageState' is not null the next page is fetch at Iterable level and the local iterator is reinitialized on the new page. -
available
public int available()Gets the number of results available locally without blocking, which may be 0.If the cursor is known to be exhausted, returns 0. If the cursor is closed before it's been exhausted, it may return a non-zero value.
- Returns:
- the number of results available locally without blocking
- Since:
- 4.4
-