Skip to main content


Showing posts from November, 2020

Functional Programming Introduction

 Greetings! One of the biggest changes happened to Java is, addition of Functional programming in Java 8. It is great because now we can use imperative, procedural, object-oriented, and functional techniques in Java. Java added functional programming to the language using Lambda expressions, Stream, Optional, default methods in interface, static methods in interface, functional interface. Let's dive into important concepts in functional programming. First of all, What is a Function? f(x) = y That is a function which gives us 'y' for a given 'x'. Let's see an easy one. f(x) = x + 1 This will give us the next value for a given 'x'. So what is the big deal here? Immutable, ie no mutation of data. No sate. No side effects. Always gives the same output for the same input. Important concepts Pure function First class function Higher order function Referential transparency Lazy evalutation C