Book description
Java developers usually tackle the complexity of software development through object-oriented programming (OOP). But not every problem is a good match for OOP. The functional programming (FP) paradigm offers you another approach to solving problems, and Java provides easy-to-grasp FP tools such as lambda expressions and Streams. If you're interested in applying FP concepts to your Java code, this book is for you.
Author Ben Weidig highlights different aspects of functional programming and shows you how to incorporate them into your code without going "fully functional." You'll learn how, when, and why to use FP concepts such as immutability and pure functions to write more concise, reasonable, and future-proof code. Many developers seek to expand their horizons by using OOP and FP together. It's no longer either-or; it's both.
In this book, you will:
- Get a high-level overview of functional programming, including the types already available to Java developers
- Explore different FP concepts and learn how to use them
- Learn how to augment your code and use Java's new functional features in your daily work without going fully functional
- Develop a functional mindset and improve your programming skills regardless of language or paradigm
Publisher resources
Table of contents
- Preface
- I. Functional Basics
- 1. An Introduction to Functional Programming
- 2. Functional Java
- 3. Functional Interfaces of the JDK
- II. A Functional Approach
- 4. Immutability
- 5. Working with Records
- 6. Data Processing with Streams
-
7. Working with Streams
- Primitive Streams
- Iterative Streams
- Infinite Streams
- From Arrays to Streams and Back
- Low-Level Stream Creation
- Working with File I/O
- Dealing with Date and Time
- Measuring Stream Performance with JMH
- More about Collectors
- Customizing Intermediate Operations (Java 22+)
- Final Thoughts on (Sequential) Streams
- Takeaways
- 8. Parallel Data Processing with Streams
- 9. Handling null with Optionals
- 10. Functional Exception Handling
- 11. Lazy Evaluation
- 12. Recursion
- 13. Asynchronous Tasks
- 14. Functional Design Patterns
- 15. A Functional Approach to Java
- Index
- About the Author
Product information
- Title: A Functional Approach to Java
- Author(s):
- Release date: May 2023
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781098109929
You might also like
book
Modern Java in Action
Manning's bestselling Java 8 book has been revised for Java 9 and 10! In Modern Java …
book
Java 8 in Action
Java 8 in Action is a clearly written guide to the new features of Java 8. …
book
Functional Programming in Java, 2nd Edition
Imagine writing Java code that reads like the problem statement, code that's highly expressive, concise, easy …
book
The Well-Grounded Java Developer, Second Edition
Understanding Java from the JVM up gives you a solid foundation to grow your expertise and …