public interface Page<T> extends Iterable<T>
A generic interface for pagination through large sets of items of type <T>.
| Modifier and Type | Method and Description |
|---|---|
long |
getPageNumber()
The page number within the count of all possible pages.
|
long |
getPageSize()
The page size which is the maximum number of items allowed in one page.
|
long |
getStart()
The start position of this page within all possible items.
|
long |
getTotalPages()
The number of pages covering all possible items.
|
long |
getTotalSize()
The total count (most likely an estimate) of all possible items in the set.
|
boolean |
hasContent()
Whether there are any items in this page.
|
boolean |
hasNext()
Returns true if internal iterator has more elements.
|
boolean |
hasNextPage()
Whether there are any items in the next page.
|
boolean |
hasPreviousPage()
Whether there is a previous page.
|
boolean |
isFirstPage() |
boolean |
isLastPage() |
Iterator<T> |
iterator()
The internal iterator of type T in this Page.
|
T |
next()
Returns the next element in the internal iterator, which is separate from any new iterator created by calls to iterator().
|
long |
size()
The count of items in this page, which is always less than getPageSize().
|
forEach, spliteratorboolean hasNext()
Returns true if internal iterator has more elements. The internal iterator is separate from any new iterator created by calls to iterator().
T next()
Returns the next element in the internal iterator, which is separate from any new iterator created by calls to iterator().
long getStart()
The start position of this page within all possible items. For result sets this is the position of the first result within the result set.
long getPageSize()
The page size which is the maximum number of items allowed in one page.
long getTotalSize()
The total count (most likely an estimate) of all possible items in the set. If this number is larger than getPageSize() then hasNextPage() should be true and you most likely can retrieve additional pages to get the remaining available items in the set. For result sets this is the number of items within the result set. For search result sets this is the estimated number of matching items. That means you may see this number change as you paginate through a search result set and the server updates the estimate with something more accurate.
long size()
The count of items in this page, which is always less than getPageSize(). If (getTotalSize() - getStart()) > getPageSize() then size() == getPageSize().
long getTotalPages()
The number of pages covering all possible items. Since this is calculated based on getTotalSize(), it is often an estimate just like getTotalSize(). That means you may see this number change as you paginate through a search result set and the server updates the estimate with something more accurate.
if ( getPageSize() == 0 ) return 0;
Math.ceil( getTotalSize() / getPageSize() );
boolean hasContent()
Whether there are any items in this page.
size() > 0; boolean hasNextPage()
Whether there are any items in the next page.
getPageNumber() < getTotalPages(); boolean hasPreviousPage()
Whether there is a previous page.
getPageNumber() > 0 long getPageNumber()
The page number within the count of all possible pages.
if ( getPageSize() == 0 ) return 0;
if ( getStart() % getPageSize() == 0 ) return getStart() / getPageSize();
else return Math.floor(getStart() / getPageSize()) + 1;
boolean isFirstPage()
getPageSize()==0 or getPageNumber()==1 boolean isLastPage()
getPageSize()==0 or getPageNumber()==getTotalPages() Copyright © 2013-2017 MarkLogic Corporation.