public interface

Page

com.atlassian.bitbucket.util.Page<T>
Known Indirect Subclasses

Class Overview

Provides support for pagination.

Pagination makes no guarantee that the next page will have a starting offset of getStart() + getLimit(). Callers must use getNextPageRequest() to navigate to the next page.

Summary

Public Methods
void forEach(Consumer<? super T> action)
Performs an action on each result in the page.
boolean getIsLastPage()
int getLimit()
@Nullable PageRequest getNextPageRequest()
@Nonnull SortedMap<Integer, T> getOrdinalIndexedValues()
Get a map of the page values mapped by their ordinal values.
int getSize()
int getStart()
@Nonnull Iterable<T> getValues()
@Nonnull Stream<T> stream()
@Nonnull <E> Page<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 Methods

public void forEach (Consumer<? super T> action)

Performs an action on each result in the page.

Parameters
action the action to apply to each result

public boolean getIsLastPage ()

Returns
  • true if there are no more results; otherwise, false if at least one more page, perhaps partially filled but not empty, of results is available

public int getLimit ()

Returns
  • the original limit on the PageRequest that generated this page

@Nullable public PageRequest getNextPageRequest ()

Returns
  • a request which can be used to retrieve the next page, which will be null if this was the last page

@Nonnull public SortedMap<Integer, T> getOrdinalIndexedValues ()

Get a map of the page values mapped by their ordinal values. For filtered pages, the ordinals are the ordinals in the underlying paged collection.

Returns
  • values mapped by their ordinal value in the page

public int getSize ()

Returns
  • the number of results in the page

public int getStart ()

Returns
  • the offset into the overall result set the page starts at (0 based)

@Nonnull public Iterable<T> getValues ()

Returns
  • the page's results

@Nonnull public Stream<T> stream ()

Returns
  • a Stream over the page's results

@Nonnull public Page<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. 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 forEach(Consumer) instead.

Parameters
transformFunction the transformer
Returns
  • a new page with transformed results