Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Java Functional Programming

You're reading from   Learning Java Functional Programming Create robust and maintainable Java applications using the functional style of programming

Arrow left icon
Product type Paperback
Published in Oct 2015
Publisher
ISBN-13 9781783558483
Length 296 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Richard M. Reese Richard M. Reese
Author Profile Icon Richard M. Reese
Richard M. Reese
Richard M Reese Richard M Reese
Author Profile Icon Richard M Reese
Richard M Reese
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Getting Started with Functional Programming 2. Putting the Function in Functional Programming FREE CHAPTER 3. Function Composition and Fluent Interfaces 4. Streams and the Evaluation of Expressions 5. Recursion Techniques in Java 8 6. Optional and Monads 7. Supporting Design Patterns Using Functional Programming 8. Refactoring, Debugging, and Testing 9. Bringing It All Together Index

Summary

In this chapter, we introduced many of the features that constitute a functional programming language. These included functions and the idea that they can be combined in more powerful ways than are possible in an imperative type language.

Functional languages frequently allow the expression of program logic using a fluent style where function invocations build upon each other. The expression of parallel behavior is simplified in functional programming languages allowing better optimization of code.

An important goal of functional programs has been to minimize the use of mutable data and avoid side effects. This also promotes certain optimizations and makes functional code more maintainable. Recursion is central to functional programming languages, and we hinted at how it can be used. The use of optional types and monads were also introduced.

Java 8 introduced several new language features that support the use of functions. These include lambda expressions, which underlie functions and functional interfaces with type inferences. The introduction of default methods enables the newer functional techniques to be used with older interfaces and classes. Method and constructor references provide a way of using these constructs where lambda expressions are expected.

With many of these topics, we provided simple examples of how Java can support these concepts. The remainder of the book provides a much more detailed discussion of how Java can be used.

Java is not a pure functional programming language. However, it supports many functional style techniques, which a knowledgeable developer can use. The use of these techniques require a different way of thinking about and approaching problems. We will convey these techniques in this book starting with a more detailed discussion of functions in Chapter 2, Putting the Function in Functional Programming.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime