These are my notes from watching the following video on Design Patterns Revisited by Venkat Subramaniam
https://www.youtube.com/watch?v=yTuwi--LFsM&t=6s
null
optionalVal.orElse("default')
Optional
shouldn’t be used as -
It is now expected to use functional iterators.
These iterators should not be used with shared mutability. i.e., modifying a collection that is declared outside the pipeline
The example in the presentation showed how a switch between stream()
and parallelStream()
resulted in different behavior when one of the operators was modifying an external list
.
Pure functions have the following characteristics -
Functional Interfaces can be passed into methods to alter the business logic
In the following example, a method is called with a Predicate
callMethod(values, n -> n == someValue)
This was a bit confusing in regards to how we can consider a default
method as a Factory method