T
- collection typepublic class AllPagesPagination<T> extends Object implements Pagination<T>
FIRST_PAGE, serialVersionUID
Constructor and Description |
---|
AllPagesPagination(Collection<T> entireCollection,
PaginationParameters paginationParameters)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
OptionalInt |
getFirstPage()
Gets the number of the first page if this is not the current page.
|
OptionalInt |
getLastPage()
Gets the number of the last page if this is not the current page.
|
OptionalInt |
getNextPage()
Gets next page if it exists.
|
int |
getNumResults()
Get the size of all the data.
|
int |
getPage()
Gets the number of the current page.
|
List<T> |
getPageOfData()
Get a list of results corresponding to the current page of data.
|
int |
getPerPage()
Gets the maximum size of a page.
|
OptionalInt |
getPreviousPage()
Gets previous page if it exists.
|
public AllPagesPagination(Collection<T> entireCollection, PaginationParameters paginationParameters) throws PageNotFoundException
entireCollection
- Collection of entries to be paginated. We guarantee consistent pagination (requesting
page 2 of the same collection always returns the same sublist) if and only if the Collection guarantees a
consistent iteration order.paginationParameters
- The parameters needed for pagination.PageNotFoundException
- if pageToFetch is greater than the number of pages.public int getPage()
Pagination
getPage
in interface Pagination<T>
public int getPerPage()
Pagination
getPerPage
in interface Pagination<T>
public OptionalInt getFirstPage()
Pagination
getFirstPage
in interface Pagination<T>
public OptionalInt getLastPage()
Pagination
getLastPage
in interface Pagination<T>
public OptionalInt getNextPage()
Pagination
getNextPage
in interface Pagination<T>
public OptionalInt getPreviousPage()
Pagination
getPreviousPage
in interface Pagination<T>
public List<T> getPageOfData()
Pagination
getPageOfData
in interface Pagination<T>
public int getNumResults()
Pagination
getNumResults
in interface Pagination<T>
Copyright © 2016–2018 Yahoo! Inc.. All rights reserved.