java.lang.Iterable<T>
DocumentPage
, PojoPage<T>
public interface Page<T>
extends java.lang.Iterable<T>
Modifier and Type | Method | 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() |
|
java.util.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().
|
java.util.Iterator<T> iterator()
hasNext()
and next()
.iterator
in interface java.lang.Iterable<T>
boolean hasNext()
T next()
long getStart()
long getPageSize()
long getTotalSize()
long size()
getTotalSize()
- getStart()
) > getPageSize()
then size() == getPageSize().long getTotalPages()
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()
size() > 0;
boolean hasNextPage()
getPageNumber() < getTotalPages();
boolean hasPreviousPage()
getPageNumber() > 0
long getPageNumber()
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-2019 MarkLogic Corporation.