IterableStream (Azure SDK for Java Reference Documentation)
David Richardson
Published Feb 17, 2026
This class provides utility to iterate over values using standard 'for-each' style loops, or to convert them into a Stream and operate in that fashion. All the values are preserved even if they are traversed multiple times.
Code sample using Stream
// process the streammyIterableStream.stream().forEach(resp -> { if (resp.getStatusCode() == HttpURLConnection.HTTP_OK) { System.out.printf("Response headers are %s. Url %s%n", resp.getDeserializedHeaders(), resp.getRequest().getUrl()); resp.getItems().forEach(value -> { System.out.printf("Response value is %d%n", value); }); }
}); Code sample using Iterator
// Iterate over iteratorfor (PagedResponseBase<String,Integer> resp : myIterableStream) { if (resp.getStatusCode() ==HttpURLConnection.HTTP_OK) {System.out.printf("Response headers are %s. Url %s%n", resp.getDeserializedHeaders(), resp.getRequest().getUrl()); resp.getItems().forEach(value -> {System.out.printf("Response value is %d%n", value); }); } }
Code sample using Stream and filter
// process the streammyIterableStream.stream().filter(resp -> resp.getStatusCode() ==HttpURLConnection.HTTP_OK) .limit(10) .forEach(resp -> {System.out.printf("Response headers are %s. Url %s%n", resp.getDeserializedHeaders(), resp.getRequest().getUrl()); resp.getItems().forEach(value -> {System.out.printf("Response value is %d%n", value); }); });