Created
March 20, 2017 21:52
-
-
Save carlosmaniero/70f0ae0d6604e3d00d0e5888211fae3a to your computer and use it in GitHub Desktop.
This file contains 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
import java.util.stream.Stream; | |
public class ReduceSum { | |
public static void main(String args[]) { | |
int sum = Stream.of(1, 2, 3, 4, 5) | |
.reduce(0, (acc, item) -> acc + item); | |
System.out.println(sum); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment