SlideShare a Scribd company logo
Copyright © 2014-2016 JavaBrahman.com
Introduction
to
Functional Programming
with Java-8
Dhruv Rai Puri
JavaBrahman.com
Copyright © 2014-2016 JavaBrahman.com
HELLO!
I am Dhruv Rai Puri
I am a Java Architect and run the technical blog JavaBrahman.com
You can reach me at
dhruvraipuri@javabrahman.com
Twitter~ @javabrahman
facebook.com/JavaBrahman
plus.google.com/+JavaBrahman
Copyright © 2014-2016 JavaBrahman.com
Whats going to be covered in this presentation
› Functional Programming
» What is functional programming
» How it’s different from imperative programming
› Important New Features in Java 8
› Functional Interfaces
› Lambda Expressions
Copyright © 2014-2016 JavaBrahman.com
What is Functional Programming
Focusses on
WHAT
is to be done
Subset of Declarative Style of Programming
Copyright © 2014-2016 JavaBrahman.com
Functional V/S Imperative
Programming
Style of Coding
Flow Control Mechanisms
Order of Execution Mutability of Variables
Primary Language Structures
Functions as 1st Class Objects
For in-depth understanding refer:
http://www.javabrahman.com/programming-principles/imperative-versus-functional-programming-paradigms-conceptual/
Copyright © 2014-2016 JavaBrahman.com
New Functional Features in Java – 8
Lambda Expressions
Eg:(String param)->{System.out.println("My lambda says "+param);};
Functional Interfaces
Eg: @FunctionalInterface
public interface Predicate<T> {
boolean test(T t);
}
(cont…)
Copyright © 2014-2016 JavaBrahman.com
New Functional Features in Java – 8(cont…)
Streams API
Eg: List filteredList = employeeList.stream()
.limit(2)
. collect(toList());
Method References
Eg: Function doubleConvertor=Double::parseDouble;
Constructor Reference: <ClassName>::new
For learning all new features in Java-8 refer:
http://www.javabrahman.com/java-8/new-features-in-java-8/
Copyright © 2014-2016 JavaBrahman.com
Functional Interfaces
› interface which has only a single abstract method
3 Types of functional interfaces
public interface CustomFunctionalInterface {
public void firstMethod();
}
1› Custom or User Defined
(cont…)
Copyright © 2014-2016 JavaBrahman.com
Functional Interfaces(cont..)
For learning in-depth about functional interfaces refer:
http://www.javabrahman.com/java-8/functional-interfaces-java-8/
//java.util.function.Predicate<T>
@FunctionalInterface
public interface Predicate<T> {
boolean test(T t);
}
2› Newly defined functional interfaces in Java 8
@FunctionalInterface
public interface Runnable {
public abstract void run();
}
3› Pre-existing functional interfaces in Java
Copyright © 2014-2016 JavaBrahman.com
Lambda Expressions
For learning in-depth about lambda expressions refer:
http://www.javabrahman.com/java-8/lambda-expressions-java-8-explained-examples/
› anonymous function which can be passed around as a
parameter thus achieving Behavior Parameterization
@FunctionalInterface
public interface FirstInterface {
//the abstract method
public void singleMethod(String param);
}
(String param)->{System.out.println("My lambda says "+param);};
Functional Interface
Corresponding Lambda Expressions
Copyright © 2014-2016 JavaBrahman.com
Q & A
Copyright © 2014-2016 JavaBrahman.com
For further reading on Java-8
 http://www.javabrahman.com/java-8/new-features-in-java-8/
 http://www.javabrahman.com/java-8/functional-interfaces-java-8/
 http://www.javabrahman.com/java-8/lambda-expressions-java-8-explained-examples/
 http://www.javabrahman.com/java-8/java-8-method-references-tutorial-examples/
 http://www.javabrahman.com/java-8/constructor-references-java-8-simplified-tutorial/
 http://www.javabrahman.com/java-8/java-8-streams-api-tutorial-with-examples/
Copyright © 2014-2016 JavaBrahman.com
Thank You

More Related Content

What's hot (20)

Lambdas
LambdasLambdas
Lambdas
malliksunkara
 
Functional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singhFunctional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singh
Harmeet Singh(Taara)
 
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Harmeet Singh(Taara)
 
Insight into java 1.8, OOP VS FP
Insight into java 1.8, OOP VS FPInsight into java 1.8, OOP VS FP
Insight into java 1.8, OOP VS FP
Syed Awais Mazhar Bukhari
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
Oleg Tsal-Tsalko
 
Functional programming with Xtend
Functional programming with XtendFunctional programming with Xtend
Functional programming with Xtend
Sven Efftinge
 
Eclipse Day India 2015 - Java 8 Overview
Eclipse Day India 2015 - Java 8 OverviewEclipse Day India 2015 - Java 8 Overview
Eclipse Day India 2015 - Java 8 Overview
Eclipse Day India
 
Xtend - better java with -less- noise
Xtend - better java with -less- noiseXtend - better java with -less- noise
Xtend - better java with -less- noise
Neeraj Bhusare
 
Xtext Webinar
Xtext WebinarXtext Webinar
Xtext Webinar
Heiko Behrens
 
Introduction to functional programming, with Elixir
Introduction to functional programming,  with ElixirIntroduction to functional programming,  with Elixir
Introduction to functional programming, with Elixir
kirandanduprolu
 
JavaScript Introductin to Functions
JavaScript Introductin to FunctionsJavaScript Introductin to Functions
JavaScript Introductin to Functions
Charles Russell
 
Scala - the good, the bad and the very ugly
Scala - the good, the bad and the very uglyScala - the good, the bad and the very ugly
Scala - the good, the bad and the very ugly
Bozhidar Bozhanov
 
PHP 5
PHP 5PHP 5
PHP 5
Rafael Corral
 
Learn To Code: Introduction to c
Learn To Code: Introduction to cLearn To Code: Introduction to c
Learn To Code: Introduction to c
SadhanaParameswaran
 
Functional programming
Functional programmingFunctional programming
Functional programming
PiumiPerera7
 
Plpgsql russia-pgconf
Plpgsql russia-pgconfPlpgsql russia-pgconf
Plpgsql russia-pgconf
Pavel Stěhule
 
Intro to java 8
Intro to java 8Intro to java 8
Intro to java 8
John Godoi
 
Web programming
Web programmingWeb programming
Web programming
Leo Mark Villar
 
Java 8
Java 8Java 8
Java 8
Sudipta K Paik
 
Functional Programming in Java
Functional Programming in JavaFunctional Programming in Java
Functional Programming in Java
Narendran Solai Sridharan
 
Functional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singhFunctional programming in java 8 by harmeet singh
Functional programming in java 8 by harmeet singh
Harmeet Singh(Taara)
 
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Harmeet Singh(Taara)
 
Functional programming with Xtend
Functional programming with XtendFunctional programming with Xtend
Functional programming with Xtend
Sven Efftinge
 
Eclipse Day India 2015 - Java 8 Overview
Eclipse Day India 2015 - Java 8 OverviewEclipse Day India 2015 - Java 8 Overview
Eclipse Day India 2015 - Java 8 Overview
Eclipse Day India
 
Xtend - better java with -less- noise
Xtend - better java with -less- noiseXtend - better java with -less- noise
Xtend - better java with -less- noise
Neeraj Bhusare
 
Introduction to functional programming, with Elixir
Introduction to functional programming,  with ElixirIntroduction to functional programming,  with Elixir
Introduction to functional programming, with Elixir
kirandanduprolu
 
JavaScript Introductin to Functions
JavaScript Introductin to FunctionsJavaScript Introductin to Functions
JavaScript Introductin to Functions
Charles Russell
 
Scala - the good, the bad and the very ugly
Scala - the good, the bad and the very uglyScala - the good, the bad and the very ugly
Scala - the good, the bad and the very ugly
Bozhidar Bozhanov
 
Learn To Code: Introduction to c
Learn To Code: Introduction to cLearn To Code: Introduction to c
Learn To Code: Introduction to c
SadhanaParameswaran
 
Functional programming
Functional programmingFunctional programming
Functional programming
PiumiPerera7
 
Intro to java 8
Intro to java 8Intro to java 8
Intro to java 8
John Godoi
 

Similar to Introduction to functional programming with java 8 (20)

Java 8 Interview Questions and Answers PDF By ScholarHat.pdf
Java 8 Interview Questions and Answers PDF By ScholarHat.pdfJava 8 Interview Questions and Answers PDF By ScholarHat.pdf
Java 8 Interview Questions and Answers PDF By ScholarHat.pdf
Scholarhat
 
Example Of Import Java
Example Of Import JavaExample Of Import Java
Example Of Import Java
Melody Rios
 
Lambdas And Streams in JDK8
Lambdas And Streams in JDK8Lambdas And Streams in JDK8
Lambdas And Streams in JDK8
Simon Ritter
 
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon Ritter
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon RitterLambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon Ritter
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon Ritter
JAXLondon2014
 
Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...
Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...
Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...
jaxLondonConference
 
BDX 2016 - Tzach zohar @ kenshoo
BDX 2016 - Tzach zohar  @ kenshooBDX 2016 - Tzach zohar  @ kenshoo
BDX 2016 - Tzach zohar @ kenshoo
Ido Shilon
 
Php OOP interview questions
Php OOP interview questionsPhp OOP interview questions
Php OOP interview questions
Harsiddhi Thakkar
 
What's New in Java 8
What's New in Java 8What's New in Java 8
What's New in Java 8
javafxpert
 
Functional Programming With Lambdas and Streams in JDK8
 Functional Programming With Lambdas and Streams in JDK8 Functional Programming With Lambdas and Streams in JDK8
Functional Programming With Lambdas and Streams in JDK8
IndicThreads
 
REST Architectural Style: A Detail Explain
REST Architectural Style: A Detail ExplainREST Architectural Style: A Detail Explain
REST Architectural Style: A Detail Explain
Nguyen Cao
 
Why Functional Programming So Hard?
Why Functional Programming So Hard?Why Functional Programming So Hard?
Why Functional Programming So Hard?
Ilya Sidorov
 
Integrating Social Apps with Content Driven Sites using Apache Rave and Sprin...
Integrating Social Apps with Content Driven Sites using Apache Rave and Sprin...Integrating Social Apps with Content Driven Sites using Apache Rave and Sprin...
Integrating Social Apps with Content Driven Sites using Apache Rave and Sprin...
ate.douma
 
Functional programming with_jdk8-s_ritter
Functional programming with_jdk8-s_ritterFunctional programming with_jdk8-s_ritter
Functional programming with_jdk8-s_ritter
Simon Ritter
 
Software Uni Conf October 2014
Software Uni Conf October 2014Software Uni Conf October 2014
Software Uni Conf October 2014
Nayden Gochev
 
Developing For Ubraa
Developing For UbraaDeveloping For Ubraa
Developing For Ubraa
Garrizaldy Santos
 
Spatial approximate string search Doc
Spatial approximate string search DocSpatial approximate string search Doc
Spatial approximate string search Doc
Sudha Hari Tech Solution Pvt ltd
 
PHP Basics
PHP BasicsPHP Basics
PHP Basics
Roohul Amin
 
Java Full Stack Developer Interview Questions PDF By ScholarHat
Java Full Stack Developer Interview Questions PDF By ScholarHatJava Full Stack Developer Interview Questions PDF By ScholarHat
Java Full Stack Developer Interview Questions PDF By ScholarHat
Scholarhat
 
Java Interview Questions for 10+ Year Experienced PDF By ScholarHat
Java Interview Questions for 10+ Year Experienced PDF By ScholarHatJava Interview Questions for 10+ Year Experienced PDF By ScholarHat
Java Interview Questions for 10+ Year Experienced PDF By ScholarHat
Scholarhat
 
Colloquium Report
Colloquium ReportColloquium Report
Colloquium Report
Mohammad Faizan
 
Java 8 Interview Questions and Answers PDF By ScholarHat.pdf
Java 8 Interview Questions and Answers PDF By ScholarHat.pdfJava 8 Interview Questions and Answers PDF By ScholarHat.pdf
Java 8 Interview Questions and Answers PDF By ScholarHat.pdf
Scholarhat
 
Example Of Import Java
Example Of Import JavaExample Of Import Java
Example Of Import Java
Melody Rios
 
Lambdas And Streams in JDK8
Lambdas And Streams in JDK8Lambdas And Streams in JDK8
Lambdas And Streams in JDK8
Simon Ritter
 
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon Ritter
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon RitterLambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon Ritter
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon Ritter
JAXLondon2014
 
Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...
Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...
Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...
jaxLondonConference
 
BDX 2016 - Tzach zohar @ kenshoo
BDX 2016 - Tzach zohar  @ kenshooBDX 2016 - Tzach zohar  @ kenshoo
BDX 2016 - Tzach zohar @ kenshoo
Ido Shilon
 
What's New in Java 8
What's New in Java 8What's New in Java 8
What's New in Java 8
javafxpert
 
Functional Programming With Lambdas and Streams in JDK8
 Functional Programming With Lambdas and Streams in JDK8 Functional Programming With Lambdas and Streams in JDK8
Functional Programming With Lambdas and Streams in JDK8
IndicThreads
 
REST Architectural Style: A Detail Explain
REST Architectural Style: A Detail ExplainREST Architectural Style: A Detail Explain
REST Architectural Style: A Detail Explain
Nguyen Cao
 
Why Functional Programming So Hard?
Why Functional Programming So Hard?Why Functional Programming So Hard?
Why Functional Programming So Hard?
Ilya Sidorov
 
Integrating Social Apps with Content Driven Sites using Apache Rave and Sprin...
Integrating Social Apps with Content Driven Sites using Apache Rave and Sprin...Integrating Social Apps with Content Driven Sites using Apache Rave and Sprin...
Integrating Social Apps with Content Driven Sites using Apache Rave and Sprin...
ate.douma
 
Functional programming with_jdk8-s_ritter
Functional programming with_jdk8-s_ritterFunctional programming with_jdk8-s_ritter
Functional programming with_jdk8-s_ritter
Simon Ritter
 
Software Uni Conf October 2014
Software Uni Conf October 2014Software Uni Conf October 2014
Software Uni Conf October 2014
Nayden Gochev
 
Java Full Stack Developer Interview Questions PDF By ScholarHat
Java Full Stack Developer Interview Questions PDF By ScholarHatJava Full Stack Developer Interview Questions PDF By ScholarHat
Java Full Stack Developer Interview Questions PDF By ScholarHat
Scholarhat
 
Java Interview Questions for 10+ Year Experienced PDF By ScholarHat
Java Interview Questions for 10+ Year Experienced PDF By ScholarHatJava Interview Questions for 10+ Year Experienced PDF By ScholarHat
Java Interview Questions for 10+ Year Experienced PDF By ScholarHat
Scholarhat
 
Ad

Recently uploaded (20)

ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptxISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
AyilurRamnath1
 
Jira Administration Training – Day 1 : Introduction
Jira Administration Training – Day 1 : IntroductionJira Administration Training – Day 1 : Introduction
Jira Administration Training – Day 1 : Introduction
Ravi Teja
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...
“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...
“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...
Edge AI and Vision Alliance
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
Edge AI and Vision Alliance
 
Dancing with AI - A Developer's Journey.pptx
Dancing with AI - A Developer's Journey.pptxDancing with AI - A Developer's Journey.pptx
Dancing with AI - A Developer's Journey.pptx
Elliott Richmond
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training RoadblocksDown the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und AnwendungsfälleDomino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
panagenda
 
Improving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevExImproving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevEx
Justin Reock
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdfvertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyesEnd-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
ThousandEyes
 
FCF- Getting Started in Cybersecurity 3.0
FCF- Getting Started in Cybersecurity 3.0FCF- Getting Started in Cybersecurity 3.0
FCF- Getting Started in Cybersecurity 3.0
RodrigoMori7
 
LSNIF: Locally-Subdivided Neural Intersection Function
LSNIF: Locally-Subdivided Neural Intersection FunctionLSNIF: Locally-Subdivided Neural Intersection Function
LSNIF: Locally-Subdivided Neural Intersection Function
Takahiro Harada
 
If You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FMEIf You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FME
Safe Software
 
Introduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUEIntroduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUE
Google Developer Group On Campus European Universities in Egypt
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
DevOps in the Modern Era - Thoughtfully Critical Podcast
DevOps in the Modern Era - Thoughtfully Critical PodcastDevOps in the Modern Era - Thoughtfully Critical Podcast
DevOps in the Modern Era - Thoughtfully Critical Podcast
Chris Wahl
 
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptxISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
AyilurRamnath1
 
Jira Administration Training – Day 1 : Introduction
Jira Administration Training – Day 1 : IntroductionJira Administration Training – Day 1 : Introduction
Jira Administration Training – Day 1 : Introduction
Ravi Teja
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...
“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...
“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...
Edge AI and Vision Alliance
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
Edge AI and Vision Alliance
 
Dancing with AI - A Developer's Journey.pptx
Dancing with AI - A Developer's Journey.pptxDancing with AI - A Developer's Journey.pptx
Dancing with AI - A Developer's Journey.pptx
Elliott Richmond
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training RoadblocksDown the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und AnwendungsfälleDomino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
panagenda
 
Improving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevExImproving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevEx
Justin Reock
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdfvertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyesEnd-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
ThousandEyes
 
FCF- Getting Started in Cybersecurity 3.0
FCF- Getting Started in Cybersecurity 3.0FCF- Getting Started in Cybersecurity 3.0
FCF- Getting Started in Cybersecurity 3.0
RodrigoMori7
 
LSNIF: Locally-Subdivided Neural Intersection Function
LSNIF: Locally-Subdivided Neural Intersection FunctionLSNIF: Locally-Subdivided Neural Intersection Function
LSNIF: Locally-Subdivided Neural Intersection Function
Takahiro Harada
 
If You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FMEIf You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FME
Safe Software
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
DevOps in the Modern Era - Thoughtfully Critical Podcast
DevOps in the Modern Era - Thoughtfully Critical PodcastDevOps in the Modern Era - Thoughtfully Critical Podcast
DevOps in the Modern Era - Thoughtfully Critical Podcast
Chris Wahl
 
Ad

Introduction to functional programming with java 8

  • 1. Copyright © 2014-2016 JavaBrahman.com Introduction to Functional Programming with Java-8 Dhruv Rai Puri JavaBrahman.com
  • 2. Copyright © 2014-2016 JavaBrahman.com HELLO! I am Dhruv Rai Puri I am a Java Architect and run the technical blog JavaBrahman.com You can reach me at [email protected] Twitter~ @javabrahman facebook.com/JavaBrahman plus.google.com/+JavaBrahman
  • 3. Copyright © 2014-2016 JavaBrahman.com Whats going to be covered in this presentation › Functional Programming » What is functional programming » How it’s different from imperative programming › Important New Features in Java 8 › Functional Interfaces › Lambda Expressions
  • 4. Copyright © 2014-2016 JavaBrahman.com What is Functional Programming Focusses on WHAT is to be done Subset of Declarative Style of Programming
  • 5. Copyright © 2014-2016 JavaBrahman.com Functional V/S Imperative Programming Style of Coding Flow Control Mechanisms Order of Execution Mutability of Variables Primary Language Structures Functions as 1st Class Objects For in-depth understanding refer: http://www.javabrahman.com/programming-principles/imperative-versus-functional-programming-paradigms-conceptual/
  • 6. Copyright © 2014-2016 JavaBrahman.com New Functional Features in Java – 8 Lambda Expressions Eg:(String param)->{System.out.println("My lambda says "+param);}; Functional Interfaces Eg: @FunctionalInterface public interface Predicate<T> { boolean test(T t); } (cont…)
  • 7. Copyright © 2014-2016 JavaBrahman.com New Functional Features in Java – 8(cont…) Streams API Eg: List filteredList = employeeList.stream() .limit(2) . collect(toList()); Method References Eg: Function doubleConvertor=Double::parseDouble; Constructor Reference: <ClassName>::new For learning all new features in Java-8 refer: http://www.javabrahman.com/java-8/new-features-in-java-8/
  • 8. Copyright © 2014-2016 JavaBrahman.com Functional Interfaces › interface which has only a single abstract method 3 Types of functional interfaces public interface CustomFunctionalInterface { public void firstMethod(); } 1› Custom or User Defined (cont…)
  • 9. Copyright © 2014-2016 JavaBrahman.com Functional Interfaces(cont..) For learning in-depth about functional interfaces refer: http://www.javabrahman.com/java-8/functional-interfaces-java-8/ //java.util.function.Predicate<T> @FunctionalInterface public interface Predicate<T> { boolean test(T t); } 2› Newly defined functional interfaces in Java 8 @FunctionalInterface public interface Runnable { public abstract void run(); } 3› Pre-existing functional interfaces in Java
  • 10. Copyright © 2014-2016 JavaBrahman.com Lambda Expressions For learning in-depth about lambda expressions refer: http://www.javabrahman.com/java-8/lambda-expressions-java-8-explained-examples/ › anonymous function which can be passed around as a parameter thus achieving Behavior Parameterization @FunctionalInterface public interface FirstInterface { //the abstract method public void singleMethod(String param); } (String param)->{System.out.println("My lambda says "+param);}; Functional Interface Corresponding Lambda Expressions
  • 11. Copyright © 2014-2016 JavaBrahman.com Q & A
  • 12. Copyright © 2014-2016 JavaBrahman.com For further reading on Java-8  http://www.javabrahman.com/java-8/new-features-in-java-8/  http://www.javabrahman.com/java-8/functional-interfaces-java-8/  http://www.javabrahman.com/java-8/lambda-expressions-java-8-explained-examples/  http://www.javabrahman.com/java-8/java-8-method-references-tutorial-examples/  http://www.javabrahman.com/java-8/constructor-references-java-8-simplified-tutorial/  http://www.javabrahman.com/java-8/java-8-streams-api-tutorial-with-examples/
  • 13. Copyright © 2014-2016 JavaBrahman.com Thank You