Skip to content

Commit 6e78f9e

Browse files
committed
---
yaml --- r: 879 b: refs/heads/master c: 2e90926 h: refs/heads/master i: 877: 00bdc1b 875: 011730a 871: 89e6d21 863: 9983b0b v: v3
1 parent 50f70f0 commit 6e78f9e

2 files changed

Lines changed: 10 additions & 26 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
2-
refs/heads/master: 3cf6af39a09272ced21ba85b8c9388846581d1e2
2+
refs/heads/master: 2e90926ac9042d6285704209eee1807ae273b2a8
33
refs/heads/travis: 0fa997e2fc9c6b61b2d91e6d163655aae67d44b6
44
refs/heads/gh-pages: 5a10432ecc75f29812e33a8236c900379509fe99

trunk/gcloud-java-storage/src/main/java/com/google/gcloud/storage/BlobListResult.java

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
import static com.google.common.base.Preconditions.checkNotNull;
2020

21+
import com.google.common.base.Function;
22+
import com.google.common.collect.Iterators;
23+
2124
import java.util.Iterator;
2225
import java.util.Objects;
2326

@@ -29,30 +32,6 @@ public class BlobListResult implements ListResult<Blob> {
2932
private final ListResult<BlobInfo> infoList;
3033
private final Storage storage;
3134

32-
private class BlobListIterator implements Iterator<Blob> {
33-
34-
private final Iterator<BlobInfo> blobInfoIterator;
35-
36-
public BlobListIterator() {
37-
this.blobInfoIterator = infoList.iterator();
38-
}
39-
40-
@Override
41-
public boolean hasNext() {
42-
return blobInfoIterator.hasNext();
43-
}
44-
45-
@Override
46-
public Blob next() {
47-
return new Blob(storage, blobInfoIterator.next());
48-
}
49-
50-
@Override
51-
public void remove() {
52-
blobInfoIterator.remove();
53-
}
54-
}
55-
5635
public BlobListResult(Storage storage, ListResult<BlobInfo> infoList) {
5736
this.storage = checkNotNull(storage);
5837
this.infoList = checkNotNull(infoList);
@@ -74,7 +53,12 @@ public ListResult<Blob> nextPage() {
7453

7554
@Override
7655
public Iterator<Blob> iterator() {
77-
return new BlobListIterator();
56+
return Iterators.transform(infoList.iterator(), new Function<BlobInfo, Blob>() {
57+
@Override
58+
public Blob apply(BlobInfo info) {
59+
return new Blob(storage, info);
60+
}
61+
});
7862
}
7963

8064
@Override

0 commit comments

Comments
 (0)