Java 8's lambdas empower us to create wonderful APIs. Javaslang lets us dive deeper into the world of functional programming by providing us with persistent data types, immutable collections and functional control structures. The results are beautiful and do just work.
During this presentation we will recall Java8's downsides and explore how Javaslang's Scala-inspired features fill-in the gaps.
8. Java 8 issues:
Only 3 functional control structures
No memoization
No lifting
No pattern matching
No tuples
Optional not Serializable/Iterable
Lack of Stream/Optional in APIs
Checked exceptions in functions
"Type pollution"
list.stream().map(...).collect(toList())
...
8
11. Potential inputs:
declared params
instance state
global state
Potential outputs:
declared returned value
mutable instance state
mutable global state
mutable params
exceptions
11
14. "Functional programming is about writing pure functions,
about removing hidden inputs and outputs as far as we can,
so that as much of our code as possible
just describes a relationship between inputs and outputs."
http://blog.jenkster.com/2015/12/what-is-functional-programming.html
14
22. λ
Function2<Integer, Integer, Integer> sum = (a, b) -> a + b;
CheckedFunction2<Integer, Integer, Integer> sum = (a, b) -> a + b;
composition
lifting
currying
memoization
22