My Account Log in

1 option

A Functional Approach to Java : augmenting object-oriented Java code with functional principles / Ben Weidig.

O'Reilly Online Learning: Academic/Public Library Edition Available online

View online
Format:
Book
Author/Creator:
Weidig, Ben, author.
Language:
English
Subjects (All):
Functional programming (Computer science).
Java (Computer program language).
Object-oriented programs (Computer programs).
Physical Description:
1 online resource
Edition:
First edition.
Place of Publication:
Sebastopol, CA : O'Reilly Media, 2023.
Summary:
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.
Contents:
Intro
Copyright
Table of Contents
Preface
New Hardware Needs a New Way of Thinking
Java Can Be Functional, Too
Why I Wrote This Book
Who Should Read This Book
What You Will Learn
What about Android?
A Functional Approach to Android
Navigating This Book
Conventions Used in This Book
Using Code Examples
O'Reilly Online Learning
Acknowledgments
Part I. Functional Basics
Chapter 1. An Introduction to Functional Programming
What Makes a Language Functional?
Functional Programming Concepts
Pure Functions and Referential Transparency
Immutability
Recursion
First-Class and Higher-Order Functions
Functional Composition
Currying
Partial Function Application
Lazy Evaluation
Advantages of Functional Programming
Disadvantages of Functional Programming
Takeaways
Chapter 2. Functional Java
What Are Java Lambdas?
Lambda Syntax
Functional Interfaces
Lambdas and Outside Variables
What about Anonymous Classes?
Lambdas in Action
Creating Lambdas
Calling Lambdas
Method References
Functional Programming Concepts in Java
Pure Functions and Referential Transparency
Immutability
First-Class Citizenship
Chapter 3. Functional Interfaces of the JDK
The Big Four Functional Interface Categories
Functions
Consumers
Suppliers
Predicates
Why So Many Functional Interface Variants?
Function Arity
Primitive Types
Bridging Functional Interfaces
Extending Functional Support
Adding Default Methods
Implementing Functional Interfaces Explicitly
Creating Static Helpers
Part II. A Functional Approach
Chapter 4. Immutability
Mutability and Data Structures in OOP
Immutability (Not Only) in FP
The State of Java Immutability
java.lang.String
Immutable Collections
Primitives and Primitive Wrappers
Immutable Math
Java Time API (JSR-310)
Enums
The final Keyword
Records
How to Achieve Immutability
Common Practices
Chapter 5. Working with Records
Data Aggregation Types
Tuples
A Simple POJO
From POJO to Immutability
From POJO to Record
Records to the Rescue
Behind the Scenes
Record Features
Missing Features
Use Cases and Common Practices
Record Validation and Data Scrubbing
Increasing Immutability
Creating Modified Copies
Records as Local Nominal Tuples
Better Optional Data Handling
Serializing Evolving Records
Record Pattern Matching (Java 19+)
Final Thoughts on Records
Chapter 6. Data Processing with Streams
Data Processing with Iteration
External Iteration
Internal Iteration
Streams as Functional Data Pipelines
Stream Features
Spliterator, the Backbone of Streams
Building Stream Pipelines
Creating a Stream
Doing the Work
Terminating the Stream
Notes:
OCLC-licensed vendor bibliographic record.
Includes index.
ISBN:
9781098109912
1098109910
OCLC:
1378930611

The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.

Find

Home Release notes

My Account

Shelf Request an item Bookmarks Fines and fees Settings

Guides

Using the Find catalog Using Articles+ Using your account