I'm calling a paginate service I can walk all the paginated collection using code like this:
Pageable pageable = PageRequest.of(0,100);
Page<Event> events = eventsService.getEventsPage(pageable);
while(!events.isLast()) {
doStuff(events)
events = eventsService.getEventsPage(events.nextPageable())
}
doStuff(events) // rest of events
is there a more elegant solution?. I need the pagination because otherwise, the system will run out of memory.