I have a list of object which contain 10000 records i am trying to split that records in each of 10,
But somehow it is not working.. can someone have a look
Page
just represents one page of data . So page.getContent()
only return all data in one page which is specified through constructor when you create this page instance . It has nothing to do with splitting the data in a page.
If you want to split a list , use Lists
from Guava
is the simplest way to go :
List> splittedList = Lists.partition(list, 10);
If you want to do pagination which split all the data stored in the database into different smaller pages , split it at the database level rather than getting the whole list to the memory to split which will be very inefficient when the entire list is large. See this for how to split it at the database level by declaring Pageable
in the query method.