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
//pure JDK8 | |
BiFunction<String, String, Integer> len_jdk8 = (s, s2) -> (s + s2).length(); | |
//javaslang | |
Function2<String, String, Integer> len = (s, s2) -> (s + s2).length(); | |
//dzieki javaslang mozemy uzyc funkcji, nawet jesli brakuje argumentow, i beda one przekazane pozniej | |
//wariant pierwszy | |
Function1<String, Function1<String, Integer>> lenCurried = len.curried(); | |
Function1<String, Integer> lenCurriedExecuted = lenCurried.apply("s1"); | |
Integer lenCurriedResult = lenCurriedExecuted.apply("s2"); | |
//wariant drugi | |
Function1<String, Integer> lenWithFirstArg = len.apply("s1"); | |
Integer result = lenWithFirstArg.apply("s2"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment