@Test public void dynamoDB() throws Exception { Map<String, AttributeValue> nextPage = new HashMap<>(); nextPage.put("abc", new AttributeValue()); Map<String, AttributeValue> donePage = new HashMap<>(); Function<ScanRequest, ScanResult> f = r -> { if (r.getExclusiveStartKey() != null) { Assert.assertTrue(r.getExclusiveStartKey().containsKey("abc")); } return new ScanResult() .withLastEvaluatedKey((r.getExclusiveStartKey() == null) ? nextPage : donePage); }; Publisher<ScanResult> publisher = Pagination.createPublisher(new ScanRequest(), f); Iterable<ScanResult> iter = Flowable.fromPublisher(publisher) .blockingIterable(); int count = 0; for (ScanResult r : iter) { ++count; } Assert.assertEquals(2, count); }
public static <R, T> Publisher<T> createPublisher(R request, Function<R, T> f) { return createPublisher(DEFAULT_POOL, request, f); }
Pagination { public static <R, T> Publisher<T> createPublisher(R request, Function<R, T> f) { return createPublisher(DEFAULT_POOL, request, f); } }
Pagination { public static <R, T> Publisher<T> createPublisher(R request, Function<R, T> f) { return createPublisher(DEFAULT_POOL, request, f); } private  Pagination(); }
Pagination { public static <R, T> Publisher<T> createPublisher(R request, Function<R, T> f) { return createPublisher(DEFAULT_POOL, request, f); } private  Pagination(); static Iterator<T> createIterator(R request, Function<R, T> f); static Iterable<T> createIterable(R request, Function<R, T> f); static Publisher<T> createPublisher(R request, Function<R, T> f); static Publisher<T> createPublisher(Executor executor, R request, Function<R, T> f); }
Pagination { public static <R, T> Publisher<T> createPublisher(R request, Function<R, T> f) { return createPublisher(DEFAULT_POOL, request, f); } private  Pagination(); static Iterator<T> createIterator(R request, Function<R, T> f); static Iterable<T> createIterable(R request, Function<R, T> f); static Publisher<T> createPublisher(R request, Function<R, T> f); static Publisher<T> createPublisher(Executor executor, R request, Function<R, T> f);  }