Created
January 19, 2020 06:24
-
-
Save nkalra0123/83d9858c7f1224f81753d8758ebd6456 to your computer and use it in GitHub Desktop.
BinaryOperator Functional Interfaces
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
// BinaryOperator | |
System.out.println("binaryOpeartor = " + Stream.of(1,2,3,4).reduce(new BinaryOperator<Integer>() { | |
@Override | |
public Integer apply(Integer x, Integer y) { | |
return x + y; | |
} | |
}).get()); | |
System.out.println("binaryOpeartor = " + Stream.of(1,2,3,4).reduce((x, y) -> x + y).get()); | |
System.out.println("binaryOpeartor = " + Stream.of(1,2,3,4).reduce(Integer::sum).get()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment