Skip to content

Instantly share code, notes, and snippets.

@nkalra0123
Created January 26, 2020 05:36
Show Gist options
  • Save nkalra0123/51170509ff49bd71488f39a67cf07443 to your computer and use it in GitHub Desktop.
Save nkalra0123/51170509ff49bd71488f39a67cf07443 to your computer and use it in GitHub Desktop.
Binary Operator
// 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());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment