Last active
August 21, 2016 12:54
-
-
Save mfuerstenau/97492be4ad21b1c8c3877ff18b608915 to your computer and use it in GitHub Desktop.
Streams can be iterated over in Java 8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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