14. Key differentiator
Higher Order Functions help with most Collection problems
that you usually solve by looping over and manually creating
intermediate containers.
Transformed results stay immutable and thread safe.
No need to reinvent the wheel.
Code becomes readable and idiomatic
"betabeers" groupBy identity mapValues (_.size)
15. Other Powerful HOF’s examples
Sum
(1 to 1000).reduceLeft( _ + _ )
(1 to 1000).sum
Partition filter
val (passed, failed) = List(49, 58, 88, 90) partition ( _ > 60 )
min
List(14, 35, -7, 46, 98).min
max
List(14, 35, -7, 46, 98).max
Imperative iteration
(1 to 10) foreach (println)
Parallel Collections
(1 to 10).par foreach(_ => println(Thread.currentThread.getName))
16. Become a Scala Master
For comprehensions
Case Classes
Futures
Options
Traits
Either
Pattern Matching
Monads
Actors
DSL’s
...