org.springframework.data.domain

## Class PageImpl<T>

- java.lang.Object
- - org.springframework.data.domain.PageImpl<T>

Type Parameters:
  `T` - the type of which the page consists.

All Implemented Interfaces:
  Serializable, Iterable<T>, Supplier<Stream<T>>, Page<T>, Slice<T>, Streamable<T>

Direct Known Subclasses:
  GeoPage

    public class PageImpl<T>
    extends Object
    implements Page<T>

Basic `Page` implementation.

Author:
  Oliver Gierke, Mark Paluch
See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`PageImpl(List<T> content)` Creates a new `PageImpl` with the given content.
`PageImpl(List<T> content, Pageable pageable, long total)` Constructor of `PageImpl`.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `equals(Object obj)`
`List<T>` `getContent()` Returns the page content as `List`.
`protected <U> List<U>` `getConvertedContent(Function<? super T,? extends U> converter)` Applies the given `Function` to the content of the `Chunk`.
`int` `getNumber()` Returns the number of the current `Slice`.
`int` `getNumberOfElements()` Returns the number of elements currently on this `Slice`.
`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`.
`long` `getTotalElements()` Returns the total amount of elements.
`int` `getTotalPages()` Returns the number of total pages.
`boolean` `hasContent()` Returns whether the `Slice` has content at all.
`int` `hashCode()`
`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.
`Iterator<T>` `iterator()`
`<U> Page<U>` `map(Function<? super T,? extends U> converter)` Returns a new `Page` with the content of the current one mapped by the given `Function`.
`Pageable` `nextPageable()` Returns the `Pageable` to request the next `Slice`.
`Pageable` `previousPageable()` Returns the `Pageable` to request the previous `Slice`.
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.springframework.data.domain.Page

`empty, empty`

### Methods inherited from interface org.springframework.data.domain.Slice

`getContent, getNumber, getNumberOfElements, getPageable, getSize, getSort, hasContent, hasPrevious, isFirst, nextOrLastPageable, nextPageable, previousOrFirstPageable, previousPageable`

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

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

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

`forEach, iterator, spliterator`

### Constructor Detail

#### PageImpl

    public PageImpl(List<T> content,
                    Pageable pageable,
                    long total)

Constructor of `PageImpl`.

Parameters:
  `content` - the content of this page, must not be null.
  `pageable` - the paging information, must not be null.
  `total` - the total amount of items available. The total might be adapted considering the length of the content given, if it is going to be the content of the last page. This is in place to mitigate inconsistencies.

#### PageImpl

    public PageImpl(List<T> content)

Creates a new `PageImpl` with the given content. This will result in the created `Page` being identical to the entire `List`.

Parameters:
  `content` - must not be null.

### Method Detail

#### getTotalPages

    public int getTotalPages()

Description copied from interface: `Page`
Returns the number of total pages.

Specified by:
  `getTotalPages` in interface `Page<T>`
Returns:
  the number of total pages

#### getTotalElements

    public long getTotalElements()

Description copied from interface: `Page`
Returns the total amount of elements.

Specified by:
  `getTotalElements` in interface `Page<T>`
Returns:
  the total amount of elements

#### hasNext

    public boolean hasNext()

Description copied from interface: `Slice`
Returns if there is a next `Slice`.

Specified by:
  `hasNext` in interface `Slice<T>`
Returns:
  if there is a next `Slice`.

#### isLast

    public boolean isLast()

Description copied from interface: `Slice`
Returns whether the current `Slice` is the last one.

Specified by:
  `isLast` in interface `Slice<T>`
Returns:

#### map

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

Description copied from interface: `Page`
Returns a new `Page` with the content of the current one mapped by the given `Function`.

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

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### equals

    public boolean equals(@Nullable
                          Object obj)

#### hashCode

    public int hashCode()

#### getNumber

    public int getNumber()

Description copied from interface: `Slice`
Returns the number of the current `Slice`. Is always non-negative.

Specified by:
  `getNumber` in interface `Slice<T>`
Returns:
  the number of the current `Slice`.

#### getSize

    public int getSize()

Description copied from interface: `Slice`
Returns the size of the `Slice`.

Specified by:
  `getSize` in interface `Slice<T>`
Returns:
  the size of the `Slice`.

#### getNumberOfElements

    public int getNumberOfElements()

Description copied from interface: `Slice`
Returns the number of elements currently on this `Slice`.

Specified by:
  `getNumberOfElements` in interface `Slice<T>`
Returns:
  the number of elements currently on this `Slice`.

#### hasPrevious

    public boolean hasPrevious()

Description copied from interface: `Slice`
Returns if there is a previous `Slice`.

Specified by:
  `hasPrevious` in interface `Slice<T>`
Returns:
  if there is a previous `Slice`.

#### isFirst

    public boolean isFirst()

Description copied from interface: `Slice`
Returns whether the current `Slice` is the first one.

Specified by:
  `isFirst` in interface `Slice<T>`
Returns:

#### nextPageable

    public Pageable nextPageable()

Description copied from interface: `Slice`
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 `Slice.hasNext()` before calling this method.

Specified by:
  `nextPageable` in interface `Slice<T>`
Returns:
See Also:
  `Slice.nextOrLastPageable()`

#### previousPageable

    public Pageable previousPageable()

Description copied from interface: `Slice`
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 `Slice.hasPrevious()` before calling this method.

Specified by:
  `previousPageable` in interface `Slice<T>`
Returns:
See Also:
  `Slice.previousPageable()`

#### hasContent

    public boolean hasContent()

Description copied from interface: `Slice`
Returns whether the `Slice` has content at all.

Specified by:
  `hasContent` in interface `Slice<T>`
Returns:

#### getContent

    public List<T> getContent()

Description copied from interface: `Slice`
Returns the page content as `List`.

Specified by:
  `getContent` in interface `Slice<T>`
Returns:

#### getPageable

    public Pageable getPageable()

Description copied from interface: `Slice`
Returns the `Pageable` that's been used to request the current `Slice`.

Specified by:
  `getPageable` in interface `Slice<T>`
Returns:

#### getSort

    public Sort getSort()

Description copied from interface: `Slice`
Returns the sorting parameters for the `Slice`.

Specified by:
  `getSort` in interface `Slice<T>`
Returns:

#### iterator

    public Iterator<T> iterator()

Specified by:
  `iterator` in interface `Iterable<T>`

#### getConvertedContent

    protected <U> List<U> getConvertedContent(Function<? super T,? extends U> converter)

Applies the given `Function` to the content of the `Chunk`.

Parameters:
  `converter` - must not be null.
Returns: