Skip to content

Instantly share code, notes, and snippets.

@cajar1988 cajar1988/ Secret
Created Oct 30, 2015

What would you like to do?
//pure JDK8
BiFunction<String, String, Integer> len_jdk8 = (s, s2) -> (s + s2).length();
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
You can’t perform that action at this time.