Package com.atlassian.bitbucket.util
Class FilteredPageImpl<T>
java.lang.Object
com.atlassian.bitbucket.util.FilteredPageImpl<T>
- Type Parameters:
T- type of the page
- All Implemented Interfaces:
Page<T>
An instance of
Page that supports pagination across an underlying paged collection.-
Constructor Summary
ConstructorsConstructorDescriptionFilteredPageImpl(PageRequest pageRequest, int size, SortedMap<Integer, T> valueMap, boolean lastPage) -
Method Summary
Modifier and TypeMethodDescriptionvoidPerforms an action on each result in the page.booleanintgetLimit()Get a map of the page values mapped by their ordinal values.intgetSize()intgetStart()stream()<E> FilteredPageImpl<E>Transforms the results on the page, producing a newPagewith differentvaluesbut all other properties (e.g.
-
Constructor Details
-
FilteredPageImpl
public FilteredPageImpl(@Nonnull PageRequest pageRequest, int size, @Nonnull SortedMap<Integer, T> valueMap, boolean lastPage)
-
-
Method Details
-
forEach
Description copied from interface:PagePerforms an action on each result in the page. -
getIsLastPage
public boolean getIsLastPage()- Specified by:
getIsLastPagein interfacePage<T>- Returns:
trueif there are no more results; otherwise,falseif at least one more page, perhaps partially filled but not empty, of results is available
-
getLimit
public int getLimit()- Specified by:
getLimitin interfacePage<T>- Returns:
- the original limit on the
PageRequestthat generated this page
-
getNextPageRequest
- Specified by:
getNextPageRequestin interfacePage<T>- Returns:
- a request which can be used to retrieve the next page, which will be
nullif this was thelast page
-
getOrdinalIndexedValues
Description copied from interface:PageGet a map of the page values mapped by their ordinal values. For filtered pages, the ordinals are the ordinals in the underlying paged collection.- Specified by:
getOrdinalIndexedValuesin interfacePage<T>- Returns:
- values mapped by their ordinal value in the page
-
getSize
public int getSize() -
getStart
public int getStart() -
getValues
-
stream
-
transform
@Nonnull public <E> FilteredPageImpl<E> transform(@Nonnull Function<? super T, ? extends E> transformFunction) Description copied from interface:PageTransforms the results on the page, producing a newPagewith differentvaluesbut all other properties (e.g.startandlimit) unchanged.Implementation note: Transformation is done eagerly to ensure the resulting
Pagedoes 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 usingPage.forEach(java.util.function.Consumer<? super T>)instead.
-