Skip to content

Instantly share code, notes, and snippets.

@amitshekhariitbhu
Last active April 7, 2019 09:31
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save amitshekhariitbhu/d48fa6481ddbb9ad6da49028f5e71cd7 to your computer and use it in GitHub Desktop.
public class PaginationActivity extends AppCompatActivity {
/**
* Simulation of network data
*/
private Single<List<String>> dataFromNetwork(final int page) {
return Single.just(true)
.delay(2, TimeUnit.SECONDS)
.map(value -> {
List<String> items = new ArrayList<>();
for (int i = 1; i <= 10; i++) {
items.add("Item " + (page * 10 + i));
}
return items;
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment