Java has undergone a major change with the release of JDK 1.8. A whole array of Functional Programming features have been added to it. I have been blogging on the new features of Java 8 for over an year now and during this time I have referenced popular Java 8 books available. The below review of 5 best books for learning Java 8 is based on my experience with reading and referring each of these books.
(includes Java 9)
Note – Java 8 in Action doesn’t have a kindle edition version at the time of writing this review. Only
Java 8 in Action or its latest edition Modern Java in Action is the best book I have come across for Java 8. The book focusses on the new features introduced in Java 8 exclusively. The initial chapters build fundamentals of functional programming. The authors have explained in detail how behaviour parametrization works with the new functional constructs introduced in Java 8. This is followed with in-depth explanation of functional interfaces, lambda expressions and streams.
The authors have taken a descriptive style of writing, interlaced with programming examples, showing the usage of the new features of Java 8. They also have exclusive practice sections, such as those on using Streams API, which show the various permutations and combinations in which one can utilize the full power of Streams.
The books then goes into deeper Java 8 areas including Parallel Streams, Spliterator, Default Methods and Optional. After covering the functional areas, authors have dedicated chapters to concurrency related Java 8 updates i.e. CompletableFutures and the new Java 8 Date Time API. The last few chapters are intended for users who want to understand functional programming inside out and talk about areas such as functional programming techniques and comparing Java 8 with another functional programming language – Scala.
Java SE 8 for the Really Impatient: A Short Course on the Basics is a to-the-point book on Java 8. There aren’t any lengthy explanations and deliberations on functional aspects of Java 8. Rather, the author has explained everything that is new in Java 8 in a concise manner. Horstmann has covered all the new features in Java 8 starting from lambdas, streams moving on to Java FX, new Date Time API, Concurrency Enhancements and changes to the Nashorn API in Java 8. If, however, you like to dwell around in fundamentals and master a topic in-and-out then I would suggest you to give this one a miss.
To sum up, if short, sweet, and concise technical explanations for new features in Java 8 is what you are looking for then go for Java SE 8 for the Really Impatient: A Short Course on the Basics by Cay S. Horstmann
One interesting tidbit about the book before the actual review. The book’s paperback edition is named as Java 8 Lambdas Functional Programming for the masses on Amazon. However, its kindle edition is named differently as Java 8 Lambdas: Pragmatic Functional Programming. Whatever maybe the reason for naming the print and kindle versions differently, one should not get confused between the two books as they are basically the same.
Coming back to the book itself, Java 8 Lambdas Functional Programming for the masses is like a quick reference to Java 8’s new features. Every topic, be it Lambdas, or the all important Streams, are briskly touched upon and their basics provided. In fact, many of the areas which should have gone into their individual chapters, such as multiple inheritance, conflict resolution and optional have been put together and covered rather quickly in a chapter titled “Libraries”. The book has separate chapters on data parallelism, and functional programming oriented design and architecture but they too seem to be delivered for quick consumption in a capsule-size.
To sum up, I would recommend Java 8 Lambdas Functional Programming for the masses as a quick reference guide with explanations for Java 8’s new functional features.
Java: The Complete Reference, Twelfth Edition is meant for those who are just starting out with learning Java. To be fair to the book, it does cover all Java 8 features in-depth. However, the style for writing the book is such that experienced Java programmers will find it a tad bit over-explanatory. Since this book is meant for all experience ranges, one cannot really find fault with the author’s approach. So, you have the 1stchapter explaining the history and evolution of Java! Next follow the basics of the languages such as data-types, arrays, classes and so on. It is in Chapter 15 that the reader is introduced to Java 8’s Lambda Expressions. Due to its focus on the elementary, the book never really goes into the high-waters of Java 8’s functional features. The reason I have included this book in this list is due to the sheer weight that the book’s acceptance has right from the first edition to this twelfth edition.
To sum up, if you are a first time learner of Java, and want to start learning with Java version 8, then Java: The Complete Reference, Twelfth Edition is the book which I would highly recommend for you.
Venkat Subramaniam is a well-known expert in the Java universe. I have seen his sessions and this guy surely has the technical depth and understanding which is required to write a book on Java 8 fundamentals. This book Functional Programming in Java: Harnessing the Power Of Java 8 Lambda Expressions is essentially that – a well-written book on Java 8 Lambdas and their impact on other features in Java. What I liked about this book is the emphasis placed by the author in driving home the fundamentals in a clear and detailed manner. On the downside, this isn’t a “complete” book on all the new features in Java 8. In fact, the book covers exactly what its title suggests – Lambda Expressions and the power that they bring to Java Programming. I would recommend this book for anyone who is interested in developing deep fundamentals in the areas of Lambda Expressions and their usage in Java 8. If you are looking for a comprehensive book covering all the new features of Java 8, then you can give this one a miss.
To sum up, Functional Programming in Java: Harnessing the Power Of Java 8 Lambda Expressions is meant for those who want to really fortify their skills around using Java 8’s functional programming fundamentals specifically around lambda expressions. If this matches your requirement then go for it.