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! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
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 (16) Chapters Close

Learning Java Functional Programming
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Getting Started with Functional Programming FREE CHAPTER 2. Putting the Function in Functional Programming 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

Index

A

  • accept method / Lambda expressions usage
  • associativity, monads / Associativity

B

  • Binary Search Tree (BST) / Using the head and tail recursion
  • bounded recursion / Using direct recursion

C

  • catch-exception library
    • URL / Testing exceptions using a fluent style
  • Character class, Functional Zork game
    • implementing / Implementing the Character class
    • pickup method, implementing / Implementing the pickup method
    • drop method, implementing / Implementing the drop method
    • walk method, implementing / Implementing the walk method
    • inventory method, implementing / Implementing the inventory method
  • classes, Functional Zork game
    • GameElements / Understanding the GameElements class
    • Item / Introducing the Item, Direction, and NPC classes
    • Direction / Introducing the Item, Direction, and NPC classes
    • NPC / Introducing the Item, Direction, and NPC classes
    • FunctionalZork / Implementing the FunctionalZork class
    • Character / Implementing the Character class
    • Location / Implementing the Location class
  • closure / Functions
    • about / Closure in Java
  • Collection interface / Collections
  • command pattern
    • about / Implementing the command pattern
    • implementing / Implementing the command pattern
    • object-oriented solution / Object-oriented solution to the command pattern
    • functional solution / Functional solution to the command pattern
  • commands, Functional Zork game
    • walk / Functional Zork
    • look / Functional Zork
    • pickup / Functional Zork
    • drop / Functional Zork
    • inventory / Functional Zork
    • directions / Functional Zork
  • compose method / Function composition, Creating composite functions in Java 8
  • composite functions
    • creating / Creating composite functions prior to Java 8
    • creating, in Java 8 / Creating composite functions in Java 8
    • functional interface, using for function composition / Using the Function interface for function composition
  • concurrent processing / Stream and concurrent processing
  • considerations, stream parallel
    • non-inference / Stream and concurrent processing, Understanding non-inference
    • stateless operations / Stream and concurrent processing, Understanding stateless operations
    • side effects / Stream and concurrent processing, Understanding side effects
    • ordering of elements / Stream and concurrent processing, Understanding the ordering
  • constructor references / Method and constructor references
  • count-distinct problem
    • reference link / The Stream class and its use
  • currying process / Functions, Currying

D

  • default method
    • about / Default methods, Default methods and functions
    • using / Default methods
    • URL / Default methods and functions
    • static default methods / Static default methods
    • in Java 8 / Default methods in Java 8
  • design patterns
    • execute-around / Implementing the execute-around-method pattern
    • factory / Implementing the factory pattern
    • command / Implementing the command pattern
    • strategy / Implementing the strategy pattern
    • visitor / Implementing the visitor pattern
    • template / Implementing the template pattern
  • Direction class, Functional Zork game
    • about / Introducing the Item, Direction, and NPC classes
  • direct recursion
    • about / Types of recursion
    • using / Using direct recursion
  • dynamic programming
    • reference link / Creating a recursive solution based on a formula

E

  • eager evaluation / Lazy and eager evaluation
  • Eclipse
    • URL / Support of other refactoring operations
    • used, for debugging lambda expressions / Debugging lambda expressions using Eclipse
  • Eclipse support, for refactoring
    • about / Eclipse support for refactoring
    • anonymous inner classes, converting to / Converting anonymous inner classes to lambda expressions
    • multiple code instances, refactoring / Refactoring multiple code instances
    • other refactoring operations / Support of other refactoring operations
  • execute-around-method pattern
    • about / Implementing the execute-around-method pattern
    • implementing / Implementing the execute-around-method pattern
    • object-oriented solution / Object-oriented solution to the execute-around-method pattern
    • functional solution / Functional solution to the execute-around-method pattern
    • using, with stream / Using the execute-around-method pattern with a stream

F

  • factory pattern
    • about / Implementing the factory pattern
    • implementing / Implementing the factory pattern
    • object-oriented solution / Object-oriented solution to the factory pattern
    • functional solution / Functional solution to the factory pattern
  • filter method, Optional class
    • using / Using the Optional class's filter method
  • filter methods, Stream class
    • about / Filter methods
    • filter method, using / Using the filter method
    • skip method, using / Using the skip method
  • first-class functions
    • about / First-class functions
  • first-come-first-serve algorithm / Object-oriented solution to strategy pattern
  • fixed length streams / Fixed length streams
  • flatMap method / Testing lambda expressions
  • fluent interfaces / Fluent interfaces
    • about / Fluent interfaces
  • function
    • returning / Returning a function
  • functional code
    • refactoring / Refactoring functional code
    • NetBeans support, for refactoring / NetBeans support for refactoring
    • Eclipse support, for refactoring / Eclipse support for refactoring
  • functional interface
    • about / Functional interfaces
    • used, for function composition / Using the Function interface for function composition
    • used, for supplementing methods / Using the Functional interface to supplement methods
    • instances, passing / Passing instances of the Functional interface
    • in Java 8 / Fluent interfaces in Java 8
    • method chaining / Method chaining and cascading
    • cascading / Method chaining and cascading
    • and method cascading, contrasting / Contrasting method cascading and fluent interfaces
    • creating / Creating and using fluent interfaces
    • using / Creating and using fluent interfaces
    • used, for hiding older interfaces/classes / Using fluent interfaces to hide older interfaces/classes
    • using, with Properties class / Using fluent interfaces with the Properties class
    • extending / Extending fluent interfaces
  • functional interfaces
    • about / Functional interfaces revisited, Common functional interfaces
    • creating / Creating a functional interface
    • function-type functional interfaces / Common functional interfaces, Function-type functional interfaces
    • predicate-type functional interfaces / Common functional interfaces, Predicate-type functional interfaces
    • consumer-type functional interfaces / Common functional interfaces, Consumer-type functional interfaces
    • supplier-type functional interfaces / Common functional interfaces, Supplier-type functional interfaces
    • operator-type functional interfaces / Common functional interfaces, Operator-type functional interfaces
  • functional Java
    • URL / Creating composite functions prior to Java 8
  • functional method / Functional interfaces revisited
  • functional programming
    • aspects / Aspects of functional programming
    • function / Functions
    • function composition / Function composition
    • fluent interfaces / Fluent interfaces
    • strict, versus non-strict evaluation / Strict versus non-strict evaluation
    • persistent data structures / Persistent data structures
    • recursion / Recursion
    • parallelism / Parallelism
    • Optional class / Optional and monads
    • monads / Optional and monads
  • functional programming concepts, Java 8
    • about / Functional programming concepts in Java
    • high-order functions / High-order functions
    • function, returning / Returning a function
    • first-class functions / First-class functions
    • pure function / The pure function
    • referential transparency / Referential transparency
    • closure / Closure in Java
    • currying / Currying
  • functional programs
    • testing / Testing functional programs
    • lambda expressions, testing / Testing lambda expressions
    • lambda expressions, copying / Copying the lambda expression
    • exceptions, testing with fluent style / Testing exceptions using a fluent style
  • functional solution, to command pattern / Functional solution to the command pattern
  • functional solution, to execute-around-method pattern / Functional solution to the execute-around-method pattern
  • functional solution, to factory pattern / Functional solution to the factory pattern
  • functional solution, to strategy pattern / Functional solution to the strategy pattern
  • functional solution, to template pattern / Functional solution to the template pattern
  • functional solution, to visitor pattern / Functional solution to the visitor pattern
  • functional style programming
    • Java 8’s support / Java 8's support for functional style programming
  • FunctionalZork class
    • implementing / Implementing the FunctionalZork class
    • initialization process / Initializing the game
    • commands, initializing / Initializing the commands
    • command, obtaining from console / Getting a command from the console
    • command, parsing / Parsing the command
    • command, executing / Executing the command
  • Functional Zork game
    • about / Functional Zork
    • commands / Functional Zork
    • playing / Playing the game
    • classes / The game's architecture
    • interfaces / The game's architecture
  • function composition
    • about / Introduction to function composition
  • Function interface
    • using / Using the Function interface
  • functions
    • about / Functions, Default methods and functions
    • pure function / Functions
    • composition / Function composition

G

  • GameElements class, Functional Zork game
    • about / Understanding the GameElements class
  • generate method
    • used, for creating infinite stream / Using the generate method to create an infinite stream

H

  • head and tail recursion
    • using / Using the head and tail recursion
  • head recursion / Types of recursion, Head and tail recursion
    • using / Using head recursion
  • high-order functions / High-order functions

I

  • infinite streams
    • about / Infinite streams
    • creating, iterate method used / Using the iterate method to create an infinite stream
    • creating, generate method used / Using the generate method to create an infinite stream
  • inorder / The Node class
  • intermediate methods / Intermediate and terminal methods
  • Item class, Functional Zork game
    • about / Introducing the Item, Direction, and NPC classes
  • iterate method
    • used, for creating infinite stream / Using the iterate method to create an infinite stream
  • iterative factorial solution
    • about / Recursive data structures
  • iterative loop
    • converting, to recursive solution / Converting an iterative loop to a recursive solution
  • iterative solution
    • about / Recursive data structures
    • reference link / Recursive data structures

J

  • Java
    • closure / Closure in Java
  • Java 8
    • functional programming concepts / Functional programming concepts in Java
    • composite functions, creating / Creating composite functions in Java 8
    • functional interface / Fluent interfaces in Java 8
    • default method / Default methods in Java 8
    • multiple inheritance / Multiple inheritance in Java 8
  • Java 8’s support
    • lambda expressions / Lambda expressions
    • default methods / Default methods
    • functional interfaces / Functional interfaces
    • method / Method and constructor references
    • constructor references / Method and constructor references
    • collections / Collections
  • JUnit
    • URL / Testing lambda expressions

L

  • lambda expressions / Functions, Lambda expressions
    • using / Lambda expressions usage
    • about / Lambda expressions revisited
    • Java 8 type inference / Java 8 type inference
    • exception handling / Exception handling in lambda expressions
    • debugging / Debugging lambda expressions
    • debugging, with NetBeans / Debugging lambda expressions using NetBeans
    • debugging, with Eclipse / Debugging lambda expressions using Eclipse
    • recursive lambda expressions, debugging / Debugging recursive lambda expressions
    • testing / Testing lambda expressions
    • copying / Copying the lambda expression
    • method reference, using / Using a method reference
    • test class, reorganizing / Reorganizing the test class
  • lazy evaluation
    • about / Lazy and eager evaluation
    • demonstrating / Lazy and eager evaluation
  • lazy loading / Lazy and eager evaluation
  • left identity, monads / Left identity
  • lists
    • merging / Merging two lists
    • reference link / Merging two lists
  • Location class, Functional Zork game
    • implementing / Implementing the Location class
    • items, handling / Handling items
    • NPCs, handling / Handling NPCs
    • directions, handling / Handling directions
  • longest-task-first algorithm / Object-oriented solution to strategy pattern

M

  • map-reduce paradigm
    • implementing / Implementing the map-reduce paradigm
  • map method, Optional class
    • using / Using the Optional class's map method
  • mapping methods,Stream class
    • about / Mapping methods
    • mapping operation / Understanding the mapping operation
    • map-reduce paradigm, implementing / Implementing the map-reduce paradigm
    • flatmap method, using / Using the flatmap method
  • maybe monad / Monads in Java 8
  • memoization / Support repeated execution
  • Memoizer
    • URL / Support repeated execution
    • about / Support repeated execution
  • method / Method and constructor references
  • monad / Optional and monads
  • monads
    • about / Monads, A formal discussion of monads
    • reference link / Monads in Java 8, A formal discussion of monads
    • unit operation / Monads in Java 8
    • bind operation / Monads in Java 8
    • associativity / Associativity
    • left identity / Left identity
    • right identity / Right identity
  • monads, in Java 8
    • about / Monads in Java 8
    • of method, using as unit function / Using the of method as the unit function
    • flatMap method, using / Using the flatMap method
    • map method, using / Using the map method
    • Optional class, using with string / Using the Optional class with strings
    • using, with Part class / Using monads with the Part class
  • multi-recursion / Types of recursion
  • mutual recursion
    • about / Types of recursion

N

  • N-Queens problem
    • about / Recursive data structures
  • NetBeans
    • used, for debugging lambda expressions / Debugging lambda expressions using NetBeans
  • NetBeans support, for refactoring
    • about / NetBeans support for refactoring
    • anonymous inner classes, converting to lambda expressions / Converting anonymous inner classes to lambda expressions
    • multiple code instances, refactoring / Refactoring multiple code instances
    • other refactoring operations, support / Support of other refactoring operations
  • Node class
    • using / The Node class
  • Non-Player Characters (NPC)
    • about / Functional Zork
  • NPC class, Functional Zork game
    • about / Introducing the Item, Direction, and NPC classes

O

  • object-oriented solution, to command pattern / Object-oriented solution to the command pattern
  • object-oriented solution, to execute-around-method pattern / Object-oriented solution to the execute-around-method pattern
  • object-oriented solution, to factory pattern / Object-oriented solution to the factory pattern
  • object-oriented solution, to strategy pattern / Object-oriented solution to strategy pattern
  • object-oriented solution, to template pattern / Object-oriented solution to the template pattern
  • object-oriented solution, to visitor pattern / Object-orient solution to the visitor pattern
  • Optional class / Optional and monads
    • using / Using the Optional class
    • used, for supporting return values / Using the Optional class to support return values
    • missing values, handling / Handling missing values
    • orElse method, used for obtaining substitute value / Using the orElse method to get a substitute value
    • orElseGet method, used for obtaining substitute value / Using the orElseGet method to use a function to get a substitute value
    • orElseThrow method, used for throwing exception / Using the orElseThrow method to throw an exception
    • values, transforming / Filter and transforming values
    • values, filtering / Filter and transforming values
    • filter method, using / Using the Optional class's filter method
    • map method, using / Using the Optional class's map method
    • solution, to Customer problem / Optional solution to the Customer problem
    • disadvantages / Disadvantages of the Optional class
    • reference link / Disadvantages of the Optional class
  • Optional instances
    • creating / Creating Optional instances

P

  • parallelism / Parallelism
  • parallel streams
    • debugging / Debugging parallel streams
  • peek method
    • used, for assisting debugging / Using the peek method to assist debugging
  • persistent data structures / Persistent data structures
  • pipelines
    • about / Monads
  • postorder / The Node class
  • preorder / The Node class
  • println method
    • used, for assisting debugging / Using the println method to assist debugging
  • program stack
    • about / Understanding the program stack
  • Properties class
    • fluent interfaces, using with / Using fluent interfaces with the Properties class
    • URL / Using fluent interfaces with the Properties class
  • pure function
    • about / Functions, The pure function
    • advantages / Functions, The pure function
    • support repeated execution / Support repeated execution
    • dependencies, eliminating between functions / Eliminating dependencies between functions
    • lazy evaluation, supporting / Supporting lazy evaluation

R

  • recursion / Recursion
    • about / Understanding recursion
    • Node class, using / The Node class
    • criticisms / When to use recursion
  • recursion humor
    • about / Recursion and humor
    • references / Recursion and humor
  • recursion implementation techniques
    • about / Recursion implementation techniques
    • wrapper method, using / Using a wrapper method
    • short circuiting, using / Using short circuiting
    • tail call optimization / Tail call optimization
    • converting, to tail call / Converting to a tail call
  • recursion types
    • about / Types of recursion
    • direct recursion / Types of recursion, Using direct recursion
    • mutual recursion / Types of recursion
    • multi-recursion / Types of recursion
    • head recursion / Types of recursion, Head and tail recursion, Using head recursion
    • tail recursion / Types of recursion, Head and tail recursion, Using tail recursion
  • recursive acronyms
    • about / Recursion and humor
    • reference link / Recursion and humor
  • recursive data structure
    • about / Recursive data structures
    • examples / Recursive data structures
  • recursive descent parsers
    • reference link / Types of recursion
  • recursive lambda expressions
    • about / Recursive lambda expressions
  • recursive solution
    • about / Recursive data structures
    • reference link / Recursive data structures
    • base case / Using direct recursion
    • recursive case / Using direct recursion
    • creating, based on formula / Creating a recursive solution based on a formula
    • iterative loop, converting to / Converting an iterative loop to a recursive solution
  • recursive solutions, issues
    • about / Common problems found in recursive solutions
    • absence, of base case / Absence of a base case
    • static variables, using / Using static or instance variables
    • instance variables, using / Using static or instance variables
    • pre-increment operators, using / Using the pre- and post-increment operators
    • post-increment operators, using / Using the pre- and post-increment operators
  • referential transparency / Functions, Referential transparency
  • return values
    • supporting, Optional class used / Using the Optional class to support return values
  • right identity, monads / Right identity

S

  • short-circuiting methods / Lazy and eager evaluation
  • short circuiting
    • using / Using short circuiting
  • shortest-task-first algorithm / Object-oriented solution to strategy pattern
  • state full / Stream and concurrent processing
  • strategy pattern
    • about / Implementing the strategy pattern
    • implementing / Implementing the strategy pattern
    • object-oriented solution / Object-oriented solution to strategy pattern
    • functional solution / Functional solution to the strategy pattern
  • stream
    • execute-around-method pattern, using with / Using the execute-around-method pattern with a stream
  • Stream class
    • about / The Stream class and its use
    • benefits / The Stream class and its use
    • intermediate methods / Intermediate and terminal methods
    • terminal methods / Intermediate and terminal methods
    • mapping methods / Mapping methods
  • Stream class methods
    • using / Using the Stream class methods
    • filter methods / Filter methods
  • stream processing / Stream and concurrent processing
  • streams
    • creating / Creating streams
    • fixed length streams / Fixed length streams
    • infinite streams / Infinite streams
    • sorting / Sorting streams
  • strict evaluation
    • versus non-strict evaluation / Strict versus non-strict evaluation

T

  • tail call / Tail call optimization
  • tail call optimization / Tail call optimization
  • tail recursion / Types of recursion, Head and tail recursion
    • using / Using tail recursion
  • template pattern
    • about / Implementing the template pattern
    • implementing / Implementing the template pattern
    • object-oriented solution / Object-oriented solution to the template pattern
    • functional solution / Functional solution to the template pattern
  • terminal methods / Intermediate and terminal methods
  • terminating method / Method chaining and cascading
  • type inference / Functional interfaces

U

  • unbounded recursion / Using direct recursion

V

  • variable capture / Closure in Java
  • visitor pattern
    • about / Implementing the visitor pattern
    • implementing / Implementing the visitor pattern
    • object-oriented solution / Object-orient solution to the visitor pattern
    • functional solution / Functional solution to the visitor pattern

W

  • wrapper method
    • using / Using a wrapper method
lock icon The rest of the chapter is locked
arrow left Previous Section
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 £13.99/month. Cancel anytime
Visually different images