Skip to content

Instantly share code, notes, and snippets.

@mfuerstenau
Last active August 21, 2016 12:54
Show Gist options
  • Save mfuerstenau/97492be4ad21b1c8c3877ff18b608915 to your computer and use it in GitHub Desktop.
Save mfuerstenau/97492be4ad21b1c8c3877ff18b608915 to your computer and use it in GitHub Desktop.
Streams can be iterated over in Java 8
public class StreamAsIterable
{
public static void main (String[] args)
{
for (String s : (Iterable<String>) Stream.of ("This", "is", "a", "stream")::iterator)
{
System.out.println (s);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment