A Functional Approach to Java

Augmenting Object-Oriented Java Code with Functional Principles

What You Will Learn

You will learn about many functional concepts and their importance and how to utilize them directly in your Java code:

  • Composition: Build modular and easy composable blocks.
  • Expressiveness: Write more concise code that clearly expresses its intent.
  • Safer code: Safer data structures without side effects that don't need to deal with race conditions or locks, which are hard to use without introducing bugs.
  • Modularity: Break down larger projects into more easily manageable modules.
  • Maintainability: Smaller functional blocks with less interconnection make changes and refactoring safer without breaking other parts of your code.
  • Data manipulation: Build efficient data manipulation pipelines with less complexity.
  • Performance: Immutability and predictability allow scaling horizontally with parallelism without much thought about it.
Even without going fully functional, your code will benefit from the concepts and idioms presented in this book. And not only your Java code. You will tackle development challenges with a functional mindset, improving your programming regardless of the used language or paradigm.

Table of Contents

Part I: Functional Basics

Introduces the history and core concepts of functional programming, how Java implements these concepts, and what types are already available to us as developers.

  • An Introduction to Functional Programming
  • Functional Java
  • Functional Interfaces of the JDK

Part II: A Functional Approach

A topic-based deep-dive through the more generalized programming concepts and how to augment them with functional principles and the newly available tools. Certain features, like Records and Streams, are highlighted with extended examples and use cases.

  • Immutability
  • Working with Records
  • Data Processing with Streams
  • Working with Streams
  • Parallel Data Processing with Streams
  • Handling null with Optionals
  • Functional Exception Handling
  • Lazy Evaluation
  • Recursion
  • Asynchronous Tasks
  • Functional Design Patterns
  • A Functional Approach to Java

Get your copy of the book now!

ISBN 9781098109929