Functional Programming in Java Harnessing the Power of Java 8 Lambda Expressions 1st Edition Venkat Subramaniam – Ebook PDF Instant Download/Delivery, ISBN: 1937785467, 9781937785468
Product details:
- ISBN 10:1937785467
- ISBN 13:9781937785468
- Author: Venkat
Intermediate level, for programmers fairly familiar with Java, but new to the functional style of programming and lambda expressions.
Get ready to program in a whole new way. Functional Programming in Java will help you quickly get on top of the new, essential Java 8 language features and the functional style that will change and improve your code. This short, targeted book will help you make the paradigm shift from the old imperative way to a less error-prone, more elegant, and concise coding style that’s also a breeze to parallelize. You’ll explore the syntax and semantics of lambda expressions, method and constructor references, and functional interfaces. You’ll design and write applications better using the new standards in Java 8 and the JDK.
Lambda expressions are lightweight, highly concise anonymous methods backed by functional interfaces in Java 8. You can use them to leap forward into a whole new world of programming in Java. With functional programming capabilities, which have been around for decades in other languages, you can now write elegant, concise, less error-prone code using standard Java. This book will guide you though the paradigm change, offer the essential details about the new features, and show you how to transition from your old way of coding to an improved style.
In this book you’ll see popular design patterns, such as decorator, builder, and strategy, come to life to solve common design problems, but with little ceremony and effort. With these new capabilities in hand, Functional Programming in Java will help you pick up techniques to implement designs that were beyond easy reach in earlier versions of Java. You’ll see how you can reap the benefits of tail call optimization, memoization, and effortless parallelization techniques.
Java 8 will change the way you write applications. If you’re eager to take advantage of the new features in the language, this is the book for you.
Table contents:
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
Wrapping Up
2. Using Collections
Iterating through a List
Transforming a List
Finding Elements
Skipping Values
Terminating Iterations
Reusing Lambda Expressions
Using Lexical Scoping and Closures
Picking an Element
Reducing a Collection to a Single Value
Joining Elements
Wrapping Up
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
Wrapping Up
4. Transforming Data
Computing Statistics
When to Use map vs. flatMap
Checking for Criteria
Partitioning a Collection
Counting Occurrences
Summing Values
Using flatMapping and filtering
Teeing Operations
Wrapping Up
5. 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
Wrapping Up
6. Working with Resources
Cleaning Up Resources
Using the Execute Around Method Pattern to Clean Up Resources
Managing Locks
Creating Concise Exception Tests
Wrapping Up
7. Being Lazy
Delayed Initialization
Lazy Evaluations
Leveraging the Laziness of Streams
Creating Infinite, Lazy Collections
Wrapping Up
8. Optimizing Recursions
Using Tail-Call Optimization
Speeding Up with Memoization
Wrapping Up
9. Composing Functions with Lambda Expressions
Using Function Composition
Using MapReduce
Taking a Leap to Parallelize
Wrapping Up
10. Error Handling
Taking a Holistic View of Error Handling
Exception Handling and Imperative Style
Checked Exceptions and Functional Style with Streams
Exception Handling vs. Functional Style
Dealing with It Downstream
Handling Failures in Functional Programming
Wrapping Up
11. Refactoring to Functional Style
Creating a Safety Net for Refactoring
Refactoring the Traditional for Loop
Refactoring More Complex Loops
Refactoring Unbounded Loops
Refactoring for-each
Refactoring to Rework the Logic
Refactoring File Processing
Refactoring Data Grouping Operations
Refactoring Nested Loops
Real-World Refactoring
Wrapping Up
12. Functional Programming Idioms
Don’t Write Dense Lambda Expressions
Prefer Method References
Properly Structure the Functional Pipeline
Keep Separate Conditions in Separate Filters
Provide Good Domain-Specific Parameter Names
Use Type Inference for Parameters
Side Effects in Functional Pipelines
Wrapping Up
13. 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
Bibliography
People also search:
functional programming in java
functional programming in javascript
advantages of functional programming in java
benefits of functional programming in java
functional programming in java pdf github