Created
July 14, 2019 07:23
-
-
Save deepakmehra10/e60b5238e9c982f0e8e30a53c71d28c8 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
Function1<Integer, Integer> incrementOne = number -> number + 1; | |
Function1<Integer, Integer> incrementTwo = number -> number + 2; | |
//with andThen function | |
Function1<Integer, Integer> resultantFunction = incrementOne.andThen(incrementTwo); | |
System.out.println(resultantFunction.apply(5)); | |
//with compose function | |
Function1<Integer, Integer> resultantFunctionWithCompose = incrementOne.compose(incrementTwo); | |
System.out.println(resultantFunctionWithCompose.apply(5)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment