Package org.springframework.data.domain
Class SliceImpl<T>
java.lang.Object
org.springframework.data.domain.SliceImpl<T>
- All Implemented Interfaces:
Serializable
,Iterable<T>
,Supplier<Stream<T>>
,Slice<T>
,Streamable<T>
Default implementation of
Slice
.- Since:
- 1.8
- Author:
- Oliver Gierke, Keegan Witt
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns the page content asList
.protected <U> List<U>
getConvertedContent
(Function<? super T, ? extends U> converter) int
Returns the number of the currentSlice
.int
Returns the number of elements currently on thisSlice
.int
getSize()
Returns the size of theSlice
.getSort()
Returns the sorting parameters for theSlice
.boolean
Returns whether theSlice
has content at all.int
hashCode()
boolean
hasNext()
Returns if there is a nextSlice
.boolean
Returns if there is a previousSlice
.boolean
isFirst()
Returns whether the currentSlice
is the first one.boolean
isLast()
Returns whether the currentSlice
is the last one.iterator()
<U> Slice<U>
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.springframework.data.domain.Slice
nextOrLastPageable, previousOrFirstPageable
-
Constructor Details
-
SliceImpl
- Parameters:
content
- the content of thisSlice
, must not be null.pageable
- the paging information, must not be null.hasNext
- whether there's another slice following the current one.
-
SliceImpl
Creates a newSliceImpl
with the given content. This will result in the createdSlice
being identical to the entireList
.- Parameters:
content
- must not be null.
-
-
Method Details
-
hasNext
public boolean hasNext()Description copied from interface:Slice
Returns if there is a nextSlice
.- Returns:
- if there is a next
Slice
.
-
map
Description copied from interface:Slice
-
toString
-
equals
-
hashCode
public int hashCode() -
getNumber
public int getNumber()Description copied from interface:Slice
Returns the number of the currentSlice
. Is always non-negative. -
getSize
public int getSize()Description copied from interface:Slice
Returns the size of theSlice
. -
getNumberOfElements
public int getNumberOfElements()Description copied from interface:Slice
Returns the number of elements currently on thisSlice
.- Specified by:
getNumberOfElements
in interfaceSlice<T>
- Returns:
- the number of elements currently on this
Slice
.
-
hasPrevious
public boolean hasPrevious()Description copied from interface:Slice
Returns if there is a previousSlice
.- Specified by:
hasPrevious
in interfaceSlice<T>
- Returns:
- if there is a previous
Slice
.
-
isFirst
public boolean isFirst()Description copied from interface:Slice
Returns whether the currentSlice
is the first one. -
isLast
public boolean isLast()Description copied from interface:Slice
Returns whether the currentSlice
is the last one. -
nextPageable
Description copied from interface:Slice
Returns thePageable
to request the nextSlice
. Can bePageable.unpaged()
in case the currentSlice
is already the last one. Clients should checkSlice.hasNext()
before calling this method.- Specified by:
nextPageable
in interfaceSlice<T>
- Returns:
- See Also:
-
previousPageable
Description copied from interface:Slice
Returns thePageable
to request the previousSlice
. Can bePageable.unpaged()
in case the currentSlice
is already the first one. Clients should checkSlice.hasPrevious()
before calling this method.- Specified by:
previousPageable
in interfaceSlice<T>
- Returns:
- See Also:
-
hasContent
public boolean hasContent()Description copied from interface:Slice
Returns whether theSlice
has content at all.- Specified by:
hasContent
in interfaceSlice<T>
- Returns:
-
getContent
Description copied from interface:Slice
Returns the page content asList
.- Specified by:
getContent
in interfaceSlice<T>
- Returns:
-
getPageable
Description copied from interface:Slice
- Specified by:
getPageable
in interfaceSlice<T>
- Returns:
-
getSort
Description copied from interface:Slice
Returns the sorting parameters for theSlice
. -
iterator
-
getConvertedContent
- Parameters:
converter
- must not be null.- Returns:
-