Last active
February 18, 2017 10:29
-
-
Save codingtim/1e24c419eefffa7d1b4a171b27627bf5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PagedDataSourceConsumer { | |
private PagedDataSource pagedDataSource; | |
public void consume() { | |
List<Entity> entities; | |
Paging nextPage = Paging.firstPage(); | |
for(entities = pagedDataSource.getEntities(nextPage); !entities.isEmpty(); entities = pagedDataSource.getEntities(nextPage)) { | |
for(Entity entity: entities) { | |
//doStuff | |
} | |
nextPage = nextPage.next(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment