@Beta public abstract class PagedIterable<E> extends com.google.common.collect.FluentIterable<IterableWithMarker<E>>
FluentIterable allowing you to lazily advance through
sequence of pages in a resultset. Typically used in apis that return only a
certain number of records at a time.
Simplest usage is to employ the concat() convenience function, and one
of the methods from FluentIterable.
// pull in new pages until it we see something interesting.
Optional firstInterestingBlob = blobstore
.list(// options //)
.concat()
.firstMatch(isInterestingBlob());
For those seeking manual control of page advances, don't use concat, and
instead look at the value of IterableWithMarker#nextToken.
PagedIteratorblobs = blobstore.list(...).iterator(); while (blobs.hasNext()) { IterableWithMarker page = blobs.next(); ProcessedResults results = process(page); if (results.shouldBeBookmarked() && page.nextMarker().isPresent()) { saveBookmark(page.nextMarker().get()); } }
| Constructor and Description |
|---|
PagedIterable() |
| Modifier and Type | Method and Description |
|---|---|
com.google.common.collect.FluentIterable<E> |
concat()
Combines all the pages into a single unmodifiable iterable.
|
allMatch, anyMatch, contains, cycle, filter, filter, first, firstMatch, from, from, get, isEmpty, last, limit, size, skip, toArray, toImmutableList, toImmutableSet, toImmutableSortedSet, toSortedImmutableList, toString, transform, transformAndConcatpublic com.google.common.collect.FluentIterable<E> concat()
FluentIterableblobs = blobstore.list(...).concat(); for (StorageMetadata blob : blobs) { process(blob); }
Iterators.concat(java.util.Iterator<? extends T>, java.util.Iterator<? extends T>)Copyright © 2009-2013 jclouds. All Rights Reserved.