Title: Provide a convenient way to get all results from a com.google.gcloud.Page · Issue #330 · googleapis/google-cloud-java · GitHub
Open Graph Title: Provide a convenient way to get all results from a com.google.gcloud.Page · Issue #330 · googleapis/google-cloud-java
X Title: Provide a convenient way to get all results from a com.google.gcloud.Page · Issue #330 · googleapis/google-cloud-java
Description: In cases when paging between different requests is not necessary (all results are consumed in the same request/thread) a common usage-pattern would be as such: Page
Open Graph Description: In cases when paging between different requests is not necessary (all results are consumed in the same request/thread) a common usage-pattern would be as such: Page
X Description: In cases when paging between different requests is not necessary (all results are consumed in the same request/thread) a common usage-pattern would be as such: Page<V> page = .... get first p...
Opengraph URL: https://github.com/googleapis/google-cloud-java/issues/330
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Provide a convenient way to get all results from a com.google.gcloud.Page","articleBody":"In cases when paging between different requests is not necessary (all results are consumed in the same request/thread) a common usage-pattern would be as such:\n\n``` java\nPage\u003cV\u003e page = .... get first page\nwhile (page != null) {\n for (V v : page.values()) {\n ...do something...\n }\n page = page.nextPage();\n}\n```\n\nor\n\n``` java\nPage\u003cV\u003e page = .... get first page\ndo {\n for (V v : page.values()) {\n ...do something...\n }\n page = page.nextPage();\n} while (page != null);\n```\n\nTo avoid this boilerplate code It would be nice to add to the `Page` class a method to return\nan `Iterator` for all the results (and let that Iterator do the paging).\n\nSome options:\n\n(1) add a static method such as Page.iterateAll(page)\n(2) an instance method such as `page.allValues()` or `page.iterateAll()` or `page.fetchAll()`\n\nAny preference or other suggestions?\n","author":{"url":"https://github.com/aozarov","@type":"Person","name":"aozarov"},"datePublished":"2015-11-06T00:44:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/330/google-cloud-java/issues/330"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ec4fe400-2bdb-3d6a-9b45-d13e7ef73d7a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C30A:3C3BEA:78C1B6:A546D7:6A4DB3B3 |
| html-safe-nonce | da986b26f9ce1f5bd14a922be88efe15f0d340ef1a0b0fad0150716e7b835c45 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzBBOjNDM0JFQTo3OEMxQjY6QTU0NkQ3OjZBNERCM0IzIiwidmlzaXRvcl9pZCI6IjkxNDc5MzEwMjM5ODMzNTg4OTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 709c6ed321abca5348bda4eb859555edc99058babfede173034415763b71f1ba |
| hovercard-subject-tag | issue:115409812 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/google-cloud-java/330/issue_layout |
| twitter:image | https://opengraph.githubassets.com/66b3d80d2aa5942cbec2f1b10098a7acba6fcfb01bbfcbdde005d93b492580ca/googleapis/google-cloud-java/issues/330 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/66b3d80d2aa5942cbec2f1b10098a7acba6fcfb01bbfcbdde005d93b492580ca/googleapis/google-cloud-java/issues/330 |
| og:image:alt | In cases when paging between different requests is not necessary (all results are consumed in the same request/thread) a common usage-pattern would be as such: Page |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | aozarov |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/google-cloud-java git https://github.com/googleapis/google-cloud-java.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 26181278 |
| octolytics-dimension-repository_nwo | googleapis/google-cloud-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 26181278 |
| octolytics-dimension-repository_network_root_nwo | googleapis/google-cloud-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 32f7b614aca06e6bbd89842b1370df1328264f68 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width