|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.common.collect.FluentIterable<IterableWithMarker<E>>
org.jclouds.collect.PagedIterable<E>
@Beta public abstract class PagedIterable<E>
Extends 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 Summary | |
|---|---|
PagedIterable()
|
|
| Method Summary | |
|---|---|
com.google.common.collect.FluentIterable<E> |
concat()
Combines all the pages into a single unmodifiable iterable. |
| Methods inherited from class com.google.common.collect.FluentIterable |
|---|
allMatch, anyMatch, contains, copyInto, cycle, filter, filter, first, firstMatch, from, from, get, index, isEmpty, last, limit, size, skip, toArray, toImmutableList, toImmutableSet, toImmutableSortedSet, toList, toMap, toSet, toSortedImmutableList, toSortedList, toSortedSet, toString, transform, transformAndConcat, uniqueIndex |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.lang.Iterable |
|---|
iterator |
| Constructor Detail |
|---|
public PagedIterable()
| Method Detail |
|---|
public 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>)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||