Friday, February 13, 2015

Java SE 8 for the Really Impatient Book Review

Last year I started working on Java 8, but knew very little of it.  I needed a way to dive into the new features, best practices, while working on a project that was going on production with a hard deadline.  I decided to grab the Java SE 8 for the Really Impatient by Cay S. Horstmann.  I put so many tabs on so many great topics/ideas that a picture is well worth it.

Few things that I picked up from the book is composing Optional value functions with flatMap

The chapter that I focused was on streams.  In my opinion, is the best feature from Java 8. Here, I learned how to transform a stream into a Map result and some of the issues that you have to keep in mind.  For example, if there is more than one element with the same key, the collector will throw an IllegalStateException.
You can override the behavior by supplying the a third function argument that determines the value for the key, given the existing and new value.
Get the book!  I'm sure you guys will enjoy it.