Spring Data Layer: Difference between getSize () and getNumberOfElements ()

What is the difference between getSize()and getNumberOfElementsin the Spring Data class org.springframework.data.domain.Slice?

Javadoc does not offer too much help here.

+4
source share
2 answers

getSize () returns the slice capacity.

getNumberOfElements () how many elements the fragment contains.

: PagingAndSortingRepository. repo.findAll( PageRequest (0,30)), , , 30 . , 10 , , 30, numberOfElements - 10.

+6

.

, , 55 , - 10.

getSize - ( ),

: , 10 . , getSize() 10 .

getNumberOfElements -

: - 10 10 . 5 .

org.springframework.data.domain.AbstractPageRequest.java -

org.springframework.data.domain.Chunk - getNumberOfElements(), (.. )

+2

Source: https://habr.com/ru/post/1652030/


All Articles