Functional Programming in Java, Second Edition (Pragmatic Bookshelf)

PragmaticBookshelf
Learn and apply the powerful streams API and lambda expressions to create highly expressive, concise, and maintainable functional style code in Java.

Venkat Subramaniam @venkats

edited by Jacquelyn Carter @jkcarter

Imagine writing Java code that reads like the problem statement, code that’s highly expressive, concise, easy to read and modify, and has reduced complexity. With the functional programming capabilities in Java, that’s not a fantasy. This book will guide you from the familiar imperative style through the practical aspects of functional programming, using plenty of examples. Apply the techniques you learn to turn highly complex imperative code into elegant and easy to understand functional style code. Updated to the latest version of Java, this edition has four new chapters on error handling, refactoring to functional style, transforming data, and idioms of functional programming.

Don’t struggle with the limitations of the imperative style; instead learn to combine object-oriented programming with the functional style to reduce the accidental complexity. Harness the functional programming capabilities of Java to create applications where the program reveals its intentions and your team can quickly understand and modify code to align with changing business requirements. Unlock the power of lambda expressions and the Streams API to turn the oft written spaghetti code into highly concise, expressive, elegant, and maintainable code. See how Streams make the arduous task of parallelizing code as easy as flipping a switch when superior speed is necessary.

Apply design patterns built around lambda expressions, safely manage resource allocations, use memoization, and learn to transform data into different forms, all while honoring immutability, and providing thread safety to leverage lazy evaluation for efficiency and parallel execution for performance. Move beyond the basics, explore the idioms for writing functional programs. Learn to think functionally by refactoring legacy code into the functional style. And, if your code runs aground due to failures, learn to properly handle errors the functional way.

Don’t drown in theory; instead learn the practical functional programming techniques to create superior Java code.


Dr. Venkat Subramaniam is an award-winning author, founder of Agile Developer, Inc., and an instructional professor at the University of Houston. He has trained and mentored thousands of software developers in the US, Canada, Europe, and Asia, and is regularly invited to speak at international conferences. He’s the (co)author of multiple books, including the 2007 Jolt Productivity award winning book Practices of an Agile Developer.


Don’t forget you can get 35% off with your Devtalk discount! Just use the coupon code “devtalk.com" at checkout :+1:

4 932 1

Latest Threads About This Book Top

ndierauf
@venkats Appears to be a broken link in Appendix 3 a(Web Resources) on Page 234, for article to “Tell, Don’t Ask”. Link goes to: https:...
0 348 0
New
Athazo
@venkats In the section “Iterating a String” found in chapter 3 “Strings, Comparators, and Filters” there seems to be a typo: “But we w...
0 394 0
New
New
New
New
New
New
New
New
New

Most Active This Week Top

Most Active This Month Top

Most Active This Year Top

Most Active Last Three Years Top

PragmaticBookshelf
Learn and apply the powerful streams API and lambda expressions to create highly expressive, concise, and maintainable functional style c...
4 932 1
New
jozshor00
@venkats On page 21: For each price from the prices list that passes through the filter(), the mapToInt() method invokes the provided ...
0 692 1
New
dtonhofer
Just some thoughts on being hard on exceptions in functional languages. On p. 167 we read: Functional style code is amazing, concise, ...
0 468 0
New
dtonhofer
On page 174: StreamAPI Should probably be Stream API Also on page 174: blow up with an exception Suggesting to change this wh...
1 430 1
New
New
New
dtonhofer
We read: We are using the amazing feature of the switch expression of Java [Java 12]. If you’re using an older version of Java, you may...
0 392 0
New
dtonhofer
A question to highlight is: Is there a way to make sure that a stream is NOT parallel, and make this evident in the code? As in: strea...
0 385 0
New
dtonhofer
As traditional , the “impure” code of page 207 in the form of a pretend test. (Doesn’t “impure” refer to performing uncontrolled side ef...
0 383 0
New
dtonhofer
Although now aged by 34 years: “The Conception, Evolution, and Application of Functional Programming Languages” by Paul Hudak (1989-09-...
0 375 0
New
New
dtonhofer
On p.27, after “Found 2 names”, we read: The filter() method returns an iterator just like the map() method does, But it really return...
2 544 3
New
New
New
dtonhofer
On page 91, we use a short method to request a stock ticker, class FinanceData However, this method is based on java.net.URL which has a...
1 534 3
New

Most Active Over Three Years Top

New
dtonhofer
We read: Recursion is a powerful and charming way to solve problems. It’s highly expressive—using recursion we can provide a solution t...
1 486 1
New
dtonhofer
In several places, the method String.toUpperCase() is misspelled as String.toUppercase() sometimes via the :: method reference, Stri...
1 502 2
New
dtonhofer
We find this code on page 61, for ListSelectFiles.java final String[] files = new File("fpij").list(new java.io.FilenameFilter()...
1 476 1
New
dtonhofer
In Chapter 9, p.164 the stream is parallelized in 1 step. This inspired my to write some test some code to call a task “in parallel”: ...
0 323 0
New
dtonhofer
As for FinanceData on page 91, the code for AirportInfo uses the suspect and soon-to-be-deprecated java.net.URL. Let’s use java.net.URI i...
0 465 0
New
dtonhofer
As previously, the code uses List<String> names = Arrays.asList(...); which yields an “array-backed list”, rather than List<S...
1 476 1
New
dtonhofer
On page 148, “An optimization problem” we read: We’ll employ a solution for a company that buys rods at wholesale and sells them at reta...
0 458 1
New
dtonhofer
@venkats At 2/3rd of the page, we read; Within the computeMaxProfit() method, we perform our task, and when it’s time to recurse we ro...
2 438 4
New
dtonhofer
On page 15, we read: In this example we’re sending a function, price -> price * 0.9, as an argument to mapToDouble The function bein...
0 317 0
New
dtonhofer
On page 90, CalculateNAVTest.java: public class CalculateNAVTest { @Test public void computeStockWorth() { final CalculateN...
1 464 1
New
dtonhofer
It turns out that Try<T> can be ameliorated by judicious application of subclassing: no need to distinguish by actual type in the s...
0 441 0
New
dtonhofer
The filter stream operation appears on several places in Chapter 2 and Chapter 3, so it’s difficult to say where to put this, but there s...
0 431 0
New
dtonhofer
I have been thinking about how to collect “two adjacent elements” in a stream, for example transform a stream of Long into a stream of Pa...
0 426 0
New
Athazo
@venkats In the section “Iterating a String” found in chapter 3 “Strings, Comparators, and Filters” there seems to be a typo: “But we w...
0 394 0
New

Get money off!

The Pragmatic Bookshelf

35% off any eBook

Simply use coupon code "devtalk.com" at checkout. See full details here.

Latest

View all Functional Programming in Java, Second Edition threads ❯