Package com.datastax.astra.client.model
Class DistinctIterator<T,F>
java.lang.Object
com.datastax.astra.client.model.DistinctIterator<T,F>
- Type Parameters:
T
- working class representing the documentF
- working class representing the field to extract from the document.
- All Implemented Interfaces:
Iterator<F>
Iterator to retrieve distinct values of a field in a document.
-
Constructor Summary
ConstructorDescriptionDistinctIterator
(PageableIterable<T> findIterable, String fieldName, Class<F> fieldClass) 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
-
DistinctIterator
Starting the cursor on an iterable to fetch more pages.- Parameters:
findIterable
- iterablefieldName
- name of the field to pickfieldClass
- type of the field to pick
-
-
Method Details
-
hasNext
public boolean hasNext() -
next
Implementing a logic of iterator combining current page and paging. A 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.
-