Constructor and Description |
---|
PageImpl(PageRequest pageRequest,
int size,
Iterable<T> values,
boolean lastPage)
|
PageImpl(PageRequest pageRequest,
Iterable<T> values,
boolean lastPage)
Creates a page from the provided
values and explicitly sets getIsLastPage() . |
PageImpl(PageRequest pageRequest,
Iterable<T> values,
boolean lastPage,
int size,
int nextPageStart)
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
void |
forEach(Consumer<? super T> action)
Performs an action on each result in the page.
|
boolean |
getIsLastPage() |
int |
getLimit() |
protected int |
getNextPageOffset() |
PageRequest |
getNextPageRequest() |
SortedMap<Integer,T> |
getOrdinalIndexedValues()
Get a map of the page values mapped by their ordinal values.
|
int |
getSize() |
int |
getStart() |
Iterable<T> |
getValues() |
int |
hashCode() |
<E> PageImpl<E> |
transform(Function<? super T,? extends E> transformFunction)
Transforms the results on the page, producing a new
Page with different values but
all other properties (e.g. |
public PageImpl(PageRequest pageRequest, int size, Iterable<T> values, boolean lastPage)
values
and explicitly sets getIsLastPage()
and
size
. The next PageRequest
will be inferred from the
start
and limit
of the provided
PageRequest
.pageRequest
- the page request used to create this pagesize
- the size of the page - i.e. the number of elements in this pagevalues
- an iterable of the valueslastPage
- if this is the last pagepublic PageImpl(PageRequest pageRequest, Iterable<T> values, boolean lastPage, int size, int nextPageStart)
values
and explicitly sets getIsLastPage()
and
size
. The next PageRequest
will start from the specified
nextPageStart
, with the same limit
as the provided PageRequest
.pageRequest
- the page request used to create this pagevalues
- an iterable of the valueslastPage
- if this is the last pagesize
- the size of the page - i.e. the number of elements in this pagenextPageStart
- index of the element that will be the first in the next pagepublic PageImpl(PageRequest pageRequest, Iterable<T> values, boolean lastPage)
values
and explicitly sets getIsLastPage()
.pageRequest
- the page request used to create this pagevalues
- an iterable of the valueslastPage
- if this is the last pagepublic void forEach(@Nonnull Consumer<? super T> action)
Page
public boolean getIsLastPage()
getIsLastPage
in interface Page<T>
true
if there are no more results; otherwise, false
if at least one more page,
perhaps partially filled but not empty, of results is availablepublic int getLimit()
getLimit
in interface Page<T>
PageRequest
that generated this pagepublic PageRequest getNextPageRequest()
getNextPageRequest
in interface Page<T>
null
if this was
the last page
@Nonnull public SortedMap<Integer,T> getOrdinalIndexedValues()
Page
getOrdinalIndexedValues
in interface Page<T>
public int getSize()
public int getStart()
@Nonnull public <E> PageImpl<E> transform(@Nonnull Function<? super T,? extends E> transformFunction)
Page
Page
with different values
but
all other properties (e.g. start
and limit
) unchanged.
Implementation note: Transformation is done eagerly to ensure the resulting Page
does
not retain a reference to the original results from the source page. If a transform is used purely to apply
some set of side effects, consider using Page.forEach(java.util.function.Consumer<? super T>)
instead.
protected int getNextPageOffset()
Copyright © 2019 Atlassian. All rights reserved.