DEV Community

Cover image for Tips of Functional Programing in Java
leavestyle
leavestyle

Posted on

Tips of Functional Programing in Java

Tips of Functional Programing in Java

There are only some concepts, details should google yourself.

  1. What is Functional Programing?
    • In mathematics, function is an expression that relates an input set to an output set.
    • Functional programming is a style of writing computer programs that treat computations as evaluating mathematical functions.
  2. Lambda Calculus
    • Lambda calculus is a universal model, a formal system to express computations based on functional abstraction.
    • Tremendous impact : functional programing languages implements lambda calculus.
  3. Concepts of functional programing
    1. First-Class and High-Order functions
    2. Pure functions
    3. Immutability
    4. Referential transparency
  4. Functional programing techniques
    1. Composition : compose(), andThen()
    2. Monads :
      • a monad allows us to wrap a value, apply a set of transformations, and get the value back with all transformations applied。
      • such as : optional、stream、future etc, those have flatMap() method we call monad.
    3. Currying
      • Currying is a mathematical technique of converting a function that takes multiple arguments into a sequence of functions that take a single argument.
      • depends on : lambda expression and closures.
      • closures : Java has a limitation that variables the enclosing scope have to be final or effectively final.
    4. Recursion

In additions, I'm a funny photographer, welcome to fellow my ins: leavestylephoto

Top comments (0)