Skip to content

Commit cc35eec

Browse files
authored
---
yaml --- r: 8223 b: refs/heads/master c: 760ea21 h: refs/heads/master i: 8221: 9a71890 8219: 6f56607 8215: 1d7d978 8207: a096344 8191: 8fe6b6e
1 parent 893559b commit cc35eec

2 files changed

Lines changed: 10 additions & 18 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: bf78f325cddc94de079f1b5086c7e823a229de03
2+
refs/heads/master: 760ea21905d2ec3fb4d0203cff138aa0df4cce04
33
refs/heads/travis: 47e4fee4fd5af9b2a8ce46f23c72ec95f9b195b2
44
refs/heads/gh-pages: 0114589947fea527ea3831330789accedbecf45c
55
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444

trunk/google-cloud-storage/README.md

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -113,27 +113,19 @@ String blobContent = new String(blob.getContent(), UTF_8);
113113
```
114114

115115
#### Listing buckets and contents of buckets
116-
Suppose that you've added more buckets and blobs, and now you want to see the names of your buckets and the contents of each one. Add the following imports:
117-
118-
```java
119-
import java.util.Iterator;
120-
```
121-
122-
Then add the following code to list all your buckets and all the blobs inside your newly created bucket.
116+
Suppose that you've added more buckets and blobs, and now you want to see the names of your buckets and the contents of each one. Add the following code to list all your buckets and all the blobs inside each bucket.
123117

124118
```java
125119
// List all your buckets
126-
Iterator<Bucket> bucketIterator = storage.list().iterateAll();
127120
System.out.println("My buckets:");
128-
while (bucketIterator.hasNext()) {
129-
System.out.println(bucketIterator.next());
130-
}
131-
132-
// List the blobs in a particular bucket
133-
Iterator<Blob> blobIterator = bucket.list().iterateAll();
134-
System.out.println("My blobs:");
135-
while (blobIterator.hasNext()) {
136-
System.out.println(blobIterator.next());
121+
while (Bucket bucket : storage.list().iterateAll()) {
122+
System.out.println(bucket);
123+
124+
// List all blobs in the bucket
125+
System.out.println("Blobs in the bucket:");
126+
for (Blob blob : bucket.list().iterateAll()) {
127+
System.out.println(blob);
128+
}
137129
}
138130
```
139131

0 commit comments

Comments
 (0)