Apply pagination on arbitrary List in Spring

Viewed 103

If you use Spring in your work - you know that sometimes you cannot write a query (JPA or native) giving you all entities you want. In these cases you have to construct a custom collection (List in most cases) with your entities. And then - the problem: pagination. How this functionality in Spring is designed to work on some arbitrary List of some entity class. If I have the List<SomeEntity> - how I should apply a Pageable to it in order to get Page<SomeEntity> with the correct content (properly sorted and paged) ?

0 Answers
Related