Foreword

There’s no doubt that the new features in Java 8, particularly lambda expressions and the Streams API, are a huge step forward for the Java language. I’ve been using Java 8 and telling developers about the new features at conferences, in workshops, and via blog posts for a several years now. What’s clear to me is that although lambdas and streams bring a more functional style of programming to Java (and also allow us to seamlessly make use of parallel processing power), it’s not these attributes that make them so appealing to developers once they start using them—it’s how much easier it is to solve certain types of problems using these idioms, and how much more productive they make us.

My passion as a developer, presenter, and writer is not just to make other developers aware of the evolution of the Java language, but to show how this evolution helps make our lives as developers easier—how we have options for simpler solutions to problems, or even solve different types of problems. What I love about Ken’s work is that he focuses on exactly this—helping you learn something new without having to wade through details you already know or don’t need, focusing on the parts of a technology that are valuable to real world developers.

I first came across Ken’s work when he presented “Making Java Groovy” at JavaOne. At the time, the team I was working on was struggling with writing readable and useful tests, and one of the solutions we were contemplating was Groovy. As a long-time Java programmer, I was reluctant to learn a whole new language just to write tests, especially when I thought I knew how to write tests. But seeing Ken talk about Groovy for Java programmers taught me a lot of what I needed to know without repeating things I already understood. It made me realise that with the right learning material I didn’t need to wade through all the details of a language just to learn the bits I cared about. I bought his book immediately.

This new book on Modern Java Recipes follows a similar theme—as experienced developers, we don’t need to learn everything about all the new features in Java 8 and 9 as if we’re new to the language, nor do we have the time to do that. What we need is a guide that quickly makes the relevant features available to us, that gives us real examples that apply to our jobs. This book is that guide. By presenting recipes based on the sorts of problems we encounter daily, and showing how to solve those using new features in Java 8 and 9, we become familiar with the updates to the language in a way that’s much more natural for us. We can evolve our skills.

Even those who’ve been using Java 8 and 9 can learn something. The section on Reduction Operators really helped me understand this functional-style programming without having to reprogram my brain. The Java 9 features that are covered are exactly the ones that are useful to us as developers, and they are not (yet) well known. This is an excellent way to get up to speed on the newest version of Java in a quick and effective fashion. There’s something in this book for every Java developer who wants to level up their knowledge.

Get Modern Java Recipes now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.