Package com.hazelcast.query
Interface PagingPredicate<K,V> 
- Type Parameters:
- K- type of the entry key
- V- type of the entry value
- All Superinterfaces:
- Predicate<K,,- V> - Serializable
This interface is a special Predicate which helps to get a page-by-page result of a query.
 It can be constructed with a page-size, an inner predicate for filtering, and a comparator for sorting.
 This class is not thread-safe and stateless. To be able to reuse for another query, one should call
 
Here is an example usage:
reset().
 Here is an example usage:
 Predicate lessEqualThanFour = Predicates.lessEqual("this", 4);
 // We are constructing our paging predicate with a predicate and a page size. In this case query results
 // are fetched in batches of two.
 PagingPredicate predicate = Predicates.pagingPredicate(lessEqualThanFour, 2);
 // we are initializing our map with integers from 0 to 10 as keys and values.
 IMap map = hazelcastInstance.getMap(...);
 for (int i = 0; i < 10; i++) {
 map.put(i, i);
 }
 // invoking the query
 Collection<Integer> values = map.values(predicate);
 System.out.println("values = " + values) // will print 'values = [0, 1]'
 predicate.nextPage(); // we are setting up paging predicate to fetch the next page in the next call.
 values = map.values(predicate);
 System.out.println("values = " + values);// will print 'values = [2, 3]'
 Entry anchor = predicate.getAnchor();
 System.out.println("anchor -> " + anchor); // will print 'anchor -> 1=1',  since the anchor is the last entry of
                                               // the previous page.
 predicate.previousPage(); // we are setting up paging predicate to fetch previous page in the next call
 values = map.values(predicate);
 System.out.println("values = " + values) // will print 'values = [0, 1]'
 - See Also:
- 
Method SummaryModifier and TypeMethodDescriptionRetrieve the anchor object which is the last value object on the previous page.Returns the comparator used by this predicate (if any).intgetPage()Returns the current page value.intReturns the page size.voidnextPage()Sets the page value to next page.voidSets the page value to previous page.voidreset()Resets for reuse.voidsetPage(int page) Sets the current page value.
- 
Method Details- 
resetvoid reset()Resets for reuse.
- 
nextPagevoid nextPage()Sets the page value to next page.
- 
previousPagevoid previousPage()Sets the page value to previous page.
- 
getPageint getPage()Returns the current page value.- Returns:
- the current page value.
 
- 
setPagevoid setPage(int page) Sets the current page value.- Parameters:
- page- the current page value.
 
- 
getPageSizeint getPageSize()Returns the page size.- Returns:
- the page size
 
- 
getComparatorComparator<Map.Entry<K,V>> getComparator()Returns the comparator used by this predicate (if any).- Returns:
- the comparator or null
 
- 
getAnchorRetrieve the anchor object which is the last value object on the previous page.Note: This method will return `null` on the first page of the query result or if the predicate was not applied for the previous page number. - Returns:
- Map.Entry the anchor object which is the last value object on the previous page
 
 
-