Your browser had forbiden JavaScript, Please launch it and recover!
Please type the keywords to search
Show all search results for:
No search results
nice1 - it geek
Upvotes from:
private <T> Stream<T> asSlowPagedSource(long pageSize, List<T> things) { PageProducer<T> producer = (offset, limit) -> { try { Thread.sleep(5000L); } catch (InterruptedException e) { throw new RuntimeException(e); } int beginIndex = offset.intValue(); int endIndex = Math.min(offset.intValue() + limit.intValue(), things.size()); return new Page<T>().setTotalResults(things.size()) .setPage(things.subList(beginIndex, endIndex)); }; return StreamSupport.stream(new PagingSourceSpliterator<>(pageSize, producer), true); }
If you wanna answer this question please Login or Register
1 Answers
nice1 - it geek
Upvotes from: