From bbede1bd0a289616373fd1335895f75ae278f8de Mon Sep 17 00:00:00 2001
From: Everett Toews
- * // pull in new pages until it we see something interesting. - * Optional- * - * For those seeking manual control of page advances, don't use concat, and - * instead look at the value of {@link IterableWithMarker#nextToken}. - * + * + * Another usage is to employ the {@link #concat} convenience function, and one + * of the methods from {@link FluentIterable}. + * *firstInterestingBlob = blobstore - * .list(// options //) - * .concat() - * .firstMatch(isInterestingBlob()); + * FluentIterable extends Image> images = imageApi.listInDetail().concat(); + * + * for (Image image: images) { + * System.out.println(image); + * } *
- * PagedIterator*blobs = blobstore.list(...).iterator(); - * while (blobs.hasNext()) { - * IterableWithMarker page = blobs.next(); - * ProcessedResults results = process(page); - * if (results.shouldBeBookmarked() && page.nextMarker().isPresent()) { - * saveBookmark(page.nextMarker().get()); - * } + * Optional extends Image> image = imageApi.listInDetail().concat().firstMatch(isInterestingImage()); + * System.out.println(image.orNull()); + * ... + * private static Predicate isInterestingImage() { + * return new Predicate () { + * {@literal @}Override + * public boolean apply(Image image) { + * return image.getName().startsWith("Arch"); + * } + * }; * } *