> + marker = set.getNextMarker();
> + iterator = set.iterator();
> + }
> +
> + @Override
> + public boolean hasNext() {
> + return iterator.hasNext() || marker != null;
> + }
> +
> + @Override
> + public StorageMetadata next() {
> + while (true) {
> + if (!iterator.hasNext()) {
> + advance();
> + }
> + StorageMetadata metadata = iterator.next();
To clarify: it is unlikely that the provider returns an empty page if there is
a marker, but since it is quite a common pattern to use fallbacks that return
empty lists on 404, we should take care and be defensive here. Don't assume
that the iterable has content at this point.
Also IMO this class deserves its own unit test to verify it behaves properly
when there are 0 pages (the initial advance returns nothing), a single page,
multiple pages, and empty pages.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/702/files#r26179656