org.springframework.data.domain

## Interface Slice<T>

All Superinterfaces:
  Iterable<T>, Streamable<T>, Supplier<Stream<T>>

All Known Subinterfaces:
  Page<T>

All Known Implementing Classes:
  GeoPage, PageImpl, SliceImpl

    public interface Slice<T>
    extends Streamable<T>

A slice of data that indicates whether there's a next or previous slice available. Allows to obtain a `Pageable` to request a previous or next `Slice`.

Since:
  1.8
Author:
  Oliver Gierke

### Method Summary

All Methods Instance Methods Abstract Methods Default Methods
`List<T>` `getContent()` Returns the page content as `List`.
`int` `getNumber()` Returns the number of the current `Slice`.
`int` `getNumberOfElements()` Returns the number of elements currently on this `Slice`.
`default Pageable` `getPageable()` Returns the `Pageable` that's been used to request the current `Slice`.
`int` `getSize()` Returns the size of the `Slice`.
`Sort` `getSort()` Returns the sorting parameters for the `Slice`.
`boolean` `hasContent()` Returns whether the `Slice` has content at all.
`boolean` `hasNext()` Returns if there is a next `Slice`.
`boolean` `hasPrevious()` Returns if there is a previous `Slice`.
`boolean` `isFirst()` Returns whether the current `Slice` is the first one.
`boolean` `isLast()` Returns whether the current `Slice` is the last one.
`<U> Slice<U>` `map(Function<? super T,? extends U> converter)` Returns a new `Slice` with the content of the current one mapped by the given `Converter`.
`default Pageable` `nextOrLastPageable()` Returns the `Pageable` describing the next slice or the one describing the current slice in case it's the last one.
`Pageable` `nextPageable()` Returns the `Pageable` to request the next `Slice`.
`default Pageable` `previousOrFirstPageable()` Returns the `Pageable` describing the previous slice or the one describing the current slice in case it's the first one.
`Pageable` `previousPageable()` Returns the `Pageable` to request the previous `Slice`.

### Methods inherited from interface org.springframework.data.util.Streamable

`and, and, and, and, empty, filter, flatMap, get, isEmpty, of, of, of, stream, toList, toSet, toStreamable, toStreamable`

### Methods inherited from interface java.lang.Iterable

`forEach, iterator, spliterator`

### Method Detail

#### getNumber

    int getNumber()

Returns the number of the current `Slice`. Is always non-negative.

Returns:
  the number of the current `Slice`.

#### getSize

    int getSize()

Returns the size of the `Slice`.

Returns:
  the size of the `Slice`.

#### getNumberOfElements

    int getNumberOfElements()

Returns the number of elements currently on this `Slice`.

Returns:
  the number of elements currently on this `Slice`.

#### getContent

    List<T> getContent()

Returns the page content as `List`.

Returns:

#### hasContent

    boolean hasContent()

Returns whether the `Slice` has content at all.

Returns:

#### getSort

    Sort getSort()

Returns the sorting parameters for the `Slice`.

Returns:

#### isFirst

    boolean isFirst()

Returns whether the current `Slice` is the first one.

Returns:

#### isLast

    boolean isLast()

Returns whether the current `Slice` is the last one.

Returns:

#### hasNext

    boolean hasNext()

Returns if there is a next `Slice`.

Returns:
  if there is a next `Slice`.

#### hasPrevious

    boolean hasPrevious()

Returns if there is a previous `Slice`.

Returns:
  if there is a previous `Slice`.

#### getPageable

    default Pageable getPageable()

Returns the `Pageable` that's been used to request the current `Slice`.

Returns:
Since:
  2.0

#### nextPageable

    Pageable nextPageable()

Returns the `Pageable` to request the next `Slice`. Can be `Pageable.unpaged()` in case the current `Slice` is already the last one. Clients should check `hasNext()` before calling this method.

Returns:
See Also:
  `nextOrLastPageable()`

#### previousPageable

    Pageable previousPageable()

Returns the `Pageable` to request the previous `Slice`. Can be `Pageable.unpaged()` in case the current `Slice` is already the first one. Clients should check `hasPrevious()` before calling this method.

Returns:
See Also:
  `previousPageable()`

#### map

    <U> Slice<U> map(Function<? super T,? extends U> converter)

Returns a new `Slice` with the content of the current one mapped by the given `Converter`.

Specified by:
  `map` in interface `Streamable<T>`
Parameters:
  `converter` - must not be null.
Returns:
  a new `Slice` with the content of the current one mapped by the given `Converter`.
Since:
  1.10
See Also:
  `Stream.map(Function)`

#### nextOrLastPageable

    default Pageable nextOrLastPageable()

Returns the `Pageable` describing the next slice or the one describing the current slice in case it's the last one.

Returns:
Since:
  2.2

#### previousOrFirstPageable

    default Pageable previousOrFirstPageable()

Returns the `Pageable` describing the previous slice or the one describing the current slice in case it's the first one.

Returns:
Since:
  2.2