@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 result set. 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 iterate.
FluentIterable extends Image> images = imageApi.listInDetail().concat();
for (Image image: images) {
System.out.println(image);
}
Another usage is to employ the concat() convenience function, and one
of the methods from FluentIterable.
Optional extends Image> image = imageApi.listInDetail().concat().firstMatch(isInterestingImage());
System.out.println(image.orNull());
...
private static Predicate isInterestingImage() {
return new Predicate() {
@Override
public boolean apply(Image image) {
return image.getName().startsWith("Arch");
}
};
}
| 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, copyInto, cycle, filter, filter, first, firstMatch, from, from, get, index, isEmpty, last, limit, size, skip, toArray, toList, toMap, toSet, toSortedList, toSortedSet, toString, transform, transformAndConcat, uniqueIndexpublic 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-2016 The Apache Software Foundation. All Rights Reserved.