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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the page content asList.protected <U> List<U>getConvertedContent(Function<? super T, ? extends U> converter) Applies the givenFunctionto the content of theChunk.intReturns the number of the currentSlice.intReturns the number of elements currently on thisSlice.intgetSize()Returns the size of theSlice.getSort()Returns the sorting parameters for theSlice.booleanReturns whether theSlicehas content at all.inthashCode()booleanhasNext()Returns if there is a nextSlice.booleanReturns if there is a previousSlice.booleanisFirst()Returns whether the currentSliceis the first one.booleanisLast()Returns whether the currentSliceis the last one.iterator()<U> Slice<U>Returns a newSlicewith the content of the current one mapped by the givenConverter.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods 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 newSliceImplwith the given content. This will result in the createdSlicebeing identical to the entireList.- Parameters:
content- must not be null.
-
-
Method Details
-
hasNext
public boolean hasNext()Description copied from interface:SliceReturns if there is a nextSlice.- Returns:
- if there is a next
Slice.
-
map
Description copied from interface:SliceReturns a newSlicewith the content of the current one mapped by the givenConverter.- Parameters:
converter- must not be null.- Returns:
- a new
Slicewith the content of the current one mapped by the givenConverter. - See Also:
-
toString
-
equals
-
hashCode
public int hashCode() -
getNumber
public int getNumber()Description copied from interface:SliceReturns the number of the currentSlice. Is always non-negative. -
getSize
public int getSize()Description copied from interface:SliceReturns the size of theSlice. -
getNumberOfElements
public int getNumberOfElements()Description copied from interface:SliceReturns the number of elements currently on thisSlice.- Specified by:
getNumberOfElementsin interfaceSlice<T>- Returns:
- the number of elements currently on this
Slice.
-
hasPrevious
public boolean hasPrevious()Description copied from interface:SliceReturns if there is a previousSlice.- Specified by:
hasPreviousin interfaceSlice<T>- Returns:
- if there is a previous
Slice.
-
isFirst
public boolean isFirst()Description copied from interface:SliceReturns whether the currentSliceis the first one. -
isLast
public boolean isLast()Description copied from interface:SliceReturns whether the currentSliceis the last one. -
nextPageable
Description copied from interface:SliceReturns thePageableto request the nextSlice. Can bePageable.unpaged()in case the currentSliceis already the last one. Clients should checkSlice.hasNext()before calling this method.- Specified by:
nextPageablein interfaceSlice<T>- Returns:
- See Also:
-
previousPageable
Description copied from interface:SliceReturns thePageableto request the previousSlice. Can bePageable.unpaged()in case the currentSliceis already the first one. Clients should checkSlice.hasPrevious()before calling this method.- Specified by:
previousPageablein interfaceSlice<T>- Returns:
- See Also:
-
hasContent
public boolean hasContent()Description copied from interface:SliceReturns whether theSlicehas content at all.- Specified by:
hasContentin interfaceSlice<T>- Returns:
-
getContent
Description copied from interface:SliceReturns the page content asList.- Specified by:
getContentin interfaceSlice<T>- Returns:
-
getPageable
Description copied from interface:Slice- Specified by:
getPageablein interfaceSlice<T>- Returns:
-
getSort
Description copied from interface:SliceReturns the sorting parameters for theSlice. -
iterator
-
getConvertedContent
Applies the givenFunctionto the content of theChunk.- Parameters:
converter- must not be null.- Returns:
-