Functional Programming in Java

TOC | Foreword 👉

Table of Contents




Who’s This Book For

What’s in This Book

Java Version Used in This Book

How to Read the Code Examples

Online Resources

1. Hello, Lambda Expressions!

Change the Way You Think

The Big Gains of Functional-Style Code

Why Code in the Functional Style?

Evolution, Not Revolution

A Little Sugar to Sweeten


2. Using Collections

Iterating through a List

Transforming a List

Finding Elements

Reusing Lambda Expressions

Using Lexical Scoping and Closures

Picking an Element

Reducing a Collection to a Single Value

Joining Elements


3. Strings, Comparators, and Filters

Iterating a String

Implementing the Comparator Interface

Multiple and Fluent Comparisons

Using the collect Method and the Collectors Class

Listing All Files in a Directory

Listing Select Files in a Directory

Listing Immediate Subdirectories Using flatMap

Watching a File Change


4. Designing with Lambda Expressions

Separating Concerns Using Lambda Expressions

Delegating Using Lambda Expressions

Decorating Using Lambda Expressions

A Peek into the default Methods

Creating Fluent Interfaces Using Lambda Expressions

Dealing with Exceptions


5. Working with Resources

Cleaning Up Resources

Using Lambda Expressions to Clean Up Resources

Managing Locks

Creating Concise Exception Tests


6. Being Lazy

Delayed Initialization

Lazy Evaluations

Leveraging the Laziness of Streams

Creating Infinite, Lazy Collections


7. Optimizing Recursions

Using Tail-Call Optimization

Speeding Up with Memoization


8. Composing with Lambda Expressions

Using Function Composition

Using MapReduce

Taking a Leap to Parallelize


9. Bringing It All Together

Essential Practices to Succeed with the Functional Style

Performance Concerns

Adopting the Functional Style

A1. Starter Set of Functional Interfaces

A2. Syntax Overview

A3. Web Resources


Copyright © 2014, The Pragmatic Bookshelf.

TOC | Foreword 👉

Functional Programming in Java by Venkat Subramaniam can be purchased in other book formats directly from The Pragmatic Programmers. If you notice a code error or formatting mistake, please let us know here so that we can fix it.




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
The Pragmatic Programmers

The Pragmatic Programmers


We create timely, practical books and learning resources on classic and cutting-edge topics to help you practice your craft and accelerate your career.