Last active
August 29, 2015 14:06
-
-
Save binarytemple/3a70c4bdfa0c69677a24 to your computer and use it in GitHub Desktop.
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
| package com.company; | |
| import java.util.Arrays; | |
| import java.util.List; | |
| import java.util.function.Supplier; | |
| import java.util.stream.Stream; | |
| import static java.lang.System.*; | |
| /** | |
| * Example of net Java 8 lambda syntax | |
| */ | |
| public class Main { | |
| public static void main(String[] args) { | |
| out.println("sdfa"); | |
| List<String> strings = Arrays.asList("foo", "bar", "baz"); | |
| strings.forEach(err::println); | |
| strings.forEach((t) -> err.println(t)); | |
| // Stream<String> = new Stream<String>(); | |
| Supplier<String> foo = new Supplier<String>() { | |
| int count = 0; | |
| @Override | |
| public String get() { | |
| count++; | |
| return "count:" + ( count -1) + ""; | |
| } | |
| }; | |
| Stream.generate(foo).limit(10).forEach(err::println); | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output is: