Interface Slice<T>
- All Superinterfaces:
Iterable<T>
- All Known Subinterfaces:
KeysetAwarePage<T>,KeysetAwareSlice<T>,Page<T>
public interface Slice<T> extends Iterable<T>
A sublist of a list of objects without knowledge of the size of the overall list, heavily inspired by Spring Data's
Slice.- Since:
- 1.2.0
- Author:
- Christian Beikov
-
Method Summary
Modifier and Type Method Description PageablecurrentPageable()List<T>getContent()Returns the slice content as Slice.intgetNumber()Returns the number of the current Slice.intgetNumberOfElements()Returns the actual number of elements currently on this Slice.intgetSize()Returns the size of the Slice i.e. what was request viaPageable.getPageSize().SortgetSort()Returns the sorting that was used for pagination.booleanhasContent()Returns whether the Slice has content at all.booleanhasNext()Returns if there is a next Slice.booleanhasPrevious()Returns if there is a previous Slice.booleanisFirst()Returns whether the current Slice is the first one.booleanisLast()Returns whether the current Slice is the last one.PageablenextPageable()PageablepreviousPageable()
-
Method Details
-
getNumber
int getNumber()Returns the number of the current Slice. Zero based.- Returns:
- The number of the current Slice.
-
getSize
int getSize()Returns the size of the Slice i.e. what was request viaPageable.getPageSize().- Returns:
- The size of the Slice.
-
getNumberOfElements
int getNumberOfElements()Returns the actual number of elements currently on this Slice.- Returns:
- The actual number of elements currently on this Slice.
-
getContent
Returns the slice content as Slice.- Returns:
- The content of the Slice
-
hasContent
boolean hasContent()Returns whether the Slice has content at all.- Returns:
trueif the content is non-empty,falseotherwise
-
getSort
Sort getSort()Returns the sorting that was used for pagination.- Returns:
- The sorting
-
isFirst
boolean isFirst()Returns whether the current Slice is the first one.- Returns:
trueif thegetNumber()is0,falseotherwise
-
isLast
boolean isLast()Returns whether the current Slice is the last one.- Returns:
trueif this is the last slice,falseotherwise
-
hasNext
boolean hasNext()Returns if there is a next Slice.- Returns:
trueifnextPageable()will return results,falseotherwise
-
hasPrevious
boolean hasPrevious()Returns if there is a previous Slice.- Returns:
trueif thegetNumber()is greater than0,falseotherwise
-
currentPageable
Pageable currentPageable() -
nextPageable
Pageable nextPageable() -
previousPageable
Pageable previousPageable()Returns thePageablethat can be used to request the previous Slice. ReturnsnullifhasPrevious()returnsfalse.
-