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 Detail

      • getNumber

        int getNumber()
        Returns the number of the current Slice. Zero based.
        Returns:
        The number of the current 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

        List<T> 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:
        true if the content is non-empty, false otherwise
      • 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:
        true if the getNumber() is 0, false otherwise
      • isLast

        boolean isLast()
        Returns whether the current Slice is the last one.
        Returns:
        true if this is the last slice, false otherwise
      • hasNext

        boolean hasNext()
        Returns if there is a next Slice.
        Returns:
        true if nextPageable() will return results, false otherwise
      • hasPrevious

        boolean hasPrevious()
        Returns if there is a previous Slice.
        Returns:
        true if the getNumber() is greater than 0, false otherwise
      • nextPageable

        Pageable nextPageable()
        Returns the Pageable that can be used to request the next Slice. Returns null if hasNext() returns false.
        Returns:
        The Pageable for the next Slice, or null if this is the last Slice
      • previousPageable

        Pageable previousPageable()
        Returns the Pageable that can be used to request the previous Slice. Returns null if hasPrevious() returns false.
        Returns:
        The Pageable for the previous Slice, or null if this is the first Slice