SlideShare a Scribd company logo
Introduction to
Functional
Programming in
Java
BY SURESH.S
Week-1 Agenda
 Overview of functional programming concepts
 Lambda expressions
 Functional interfaces
 Method References
Functional Programming Paradigm
 Functional programming is a programming paradigm in which we try to bind
everything in pure mathematical functions style.
 It is a declarative type of programming style.
 Its main focus is on “what to solve” in contrast to an imperative style where the main
focus is “how to solve”.
 It uses expressions instead of statements.
Java – Object Oriented Programming
Java 8 – Functional Programming
Let’s c an example
Java 8
 Oracle released a new version of Java as Java 8 in March 18, 2014.
 It includes various upgrades to the Java programming, JVM, Tools and libraries.
 Java 8 is the latest release for Java that contains new features, enhancements and
bug fixes to improve efficiency to develop and run Java programs.
 It was a revolutionary release of the Java for software development platform
Functional Interface:
 An Interface that contains exactly one abstract method is known as functional
interface.
 It can have any number of default, static methods but can contain only one abstract
method.
 The functional interface is used to support the functional programming approach,
lambda expression, and method reference as well.
Lambda expressions:
 Lambda expression is also known as an anonymous function.
 It is designed to provide the implementation of a functional interface.
Syntax
(list of arguments) -> { expression body}
 1. list of arguments can be zero, one, or more.
 2. expression body can have one or more statements.
Let’s c an example
Method Reference :
 Method reference is used to refer method of functional interface.
 It is compact and easy form of lambda expression.
 Each time when you are using lambda expression to just referring a method, you
can replace your lambda expression with method reference.
Types of Method References
There are following types of method references.
 Reference to a static method.
 Reference to an instance method.
 Reference to a constructor.
Advantages?
Streams API
 A Java Stream is a component that is capable to perform internal operations of its
elements.
 For example, it can iterate its elements itself.
 A stream source can be a Collection, an array, or an I/O channel.
Java Example: Filtering Collection without using Stream
Java Stream Example: Filtering Collection by using Stream
Java Stream Example: Map Collection by using Stream
Java Stream Example : reduce() Method in Collection
Java Stream Iterating Example
THANK YOU
Will see in Next Class

More Related Content

PPTX
Insight into java 1.8, OOP VS FP
Syed Awais Mazhar Bukhari
 
PPTX
Java Lambda Expressions.pptx
SameerAhmed593310
 
PDF
Java 8 Interview Questions and Answers PDF By ScholarHat.pdf
Scholarhat
 
DOCX
Colloquium Report
Mohammad Faizan
 
PDF
Functional programming in java 8 by harmeet singh
Harmeet Singh(Taara)
 
PPTX
Lambdas, Collections Framework, Stream API
Prabu U
 
PDF
Eclipse and Java 8 - Eclipse Day India 2013
Noopur Gupta
 
PDF
Java 8-revealed
Hamed Hatami
 
Insight into java 1.8, OOP VS FP
Syed Awais Mazhar Bukhari
 
Java Lambda Expressions.pptx
SameerAhmed593310
 
Java 8 Interview Questions and Answers PDF By ScholarHat.pdf
Scholarhat
 
Colloquium Report
Mohammad Faizan
 
Functional programming in java 8 by harmeet singh
Harmeet Singh(Taara)
 
Lambdas, Collections Framework, Stream API
Prabu U
 
Eclipse and Java 8 - Eclipse Day India 2013
Noopur Gupta
 
Java 8-revealed
Hamed Hatami
 

Similar to Week-1.................................. (20)

PPTX
Introduction of Java 8 with emphasis on Lambda Expressions and Streams
Emiel Paasschens
 
PPTX
Java 8 - An Overview
Indrajit Das
 
PDF
Java8 features
Minal Maniar
 
PDF
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
New York City College of Technology Computer Systems Technology Colloquium
 
ODP
Introduction to Java 8
Knoldus Inc.
 
PPTX
New Features of JAVA SE8
Dinesh Pathak
 
PPTX
Java 8 - Features Overview
Sergii Stets
 
PPTX
Java_Interview Qns
ManikandanRamanujam
 
PDF
Multi-dimensional exploration of API usage - ICPC13 - 21-05-13
Coen De Roover
 
PPT
Lambdas
malliksunkara
 
PPTX
Functional Interfaces and Method References.pptx
MuhammadSalman701062
 
PPTX
Lambda Expressions Java 8 Features usage
AsmaShaikh478737
 
PPTX
Lambda expressions java8 - yousry
yousry ibrahim
 
PDF
Unit-3.pptx.pdf java api knowledge apiii
mpfbaa
 
PPTX
Functional Programming In Jdk8
Bansilal Haudakari
 
PDF
Java 8 Lambdas
docupevdv
 
PPT
14274730 (1).ppt
aptechaligarh
 
PDF
Core_Java_Interview.pdf
ansariparveen06
 
PDF
Smart Migration to JDK 8
Geertjan Wielenga
 
PDF
Java 8 Lambda Expressions & Streams
NewCircle Training
 
Introduction of Java 8 with emphasis on Lambda Expressions and Streams
Emiel Paasschens
 
Java 8 - An Overview
Indrajit Das
 
Java8 features
Minal Maniar
 
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
New York City College of Technology Computer Systems Technology Colloquium
 
Introduction to Java 8
Knoldus Inc.
 
New Features of JAVA SE8
Dinesh Pathak
 
Java 8 - Features Overview
Sergii Stets
 
Java_Interview Qns
ManikandanRamanujam
 
Multi-dimensional exploration of API usage - ICPC13 - 21-05-13
Coen De Roover
 
Lambdas
malliksunkara
 
Functional Interfaces and Method References.pptx
MuhammadSalman701062
 
Lambda Expressions Java 8 Features usage
AsmaShaikh478737
 
Lambda expressions java8 - yousry
yousry ibrahim
 
Unit-3.pptx.pdf java api knowledge apiii
mpfbaa
 
Functional Programming In Jdk8
Bansilal Haudakari
 
Java 8 Lambdas
docupevdv
 
14274730 (1).ppt
aptechaligarh
 
Core_Java_Interview.pdf
ansariparveen06
 
Smart Migration to JDK 8
Geertjan Wielenga
 
Java 8 Lambda Expressions & Streams
NewCircle Training
 
Ad

Recently uploaded (20)

PPTX
Inventory management chapter in automation and robotics.
atisht0104
 
PPTX
22PCOAM21 Session 1 Data Management.pptx
Guru Nanak Technical Institutions
 
PDF
FLEX-LNG-Company-Presentation-Nov-2017.pdf
jbloggzs
 
PDF
All chapters of Strength of materials.ppt
girmabiniyam1234
 
PDF
Chad Ayach - A Versatile Aerospace Professional
Chad Ayach
 
PPTX
Tunnel Ventilation System in Kanpur Metro
220105053
 
PDF
Unit I Part II.pdf : Security Fundamentals
Dr. Madhuri Jawale
 
DOCX
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
PDF
Zero Carbon Building Performance standard
BassemOsman1
 
PDF
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
PDF
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
PDF
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
PDF
20ME702-Mechatronics-UNIT-1,UNIT-2,UNIT-3,UNIT-4,UNIT-5, 2025-2026
Mohanumar S
 
PDF
Packaging Tips for Stainless Steel Tubes and Pipes
heavymetalsandtubes
 
PPTX
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
PPTX
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
PPTX
Online Cab Booking and Management System.pptx
diptipaneri80
 
PPT
1. SYSTEMS, ROLES, AND DEVELOPMENT METHODOLOGIES.ppt
zilow058
 
PDF
settlement FOR FOUNDATION ENGINEERS.pdf
Endalkazene
 
PPTX
Victory Precisions_Supplier Profile.pptx
victoryprecisions199
 
Inventory management chapter in automation and robotics.
atisht0104
 
22PCOAM21 Session 1 Data Management.pptx
Guru Nanak Technical Institutions
 
FLEX-LNG-Company-Presentation-Nov-2017.pdf
jbloggzs
 
All chapters of Strength of materials.ppt
girmabiniyam1234
 
Chad Ayach - A Versatile Aerospace Professional
Chad Ayach
 
Tunnel Ventilation System in Kanpur Metro
220105053
 
Unit I Part II.pdf : Security Fundamentals
Dr. Madhuri Jawale
 
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
Zero Carbon Building Performance standard
BassemOsman1
 
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
Introduction to Ship Engine Room Systems.pdf
Mahmoud Moghtaderi
 
20ME702-Mechatronics-UNIT-1,UNIT-2,UNIT-3,UNIT-4,UNIT-5, 2025-2026
Mohanumar S
 
Packaging Tips for Stainless Steel Tubes and Pipes
heavymetalsandtubes
 
IoT_Smart_Agriculture_Presentations.pptx
poojakumari696707
 
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
Online Cab Booking and Management System.pptx
diptipaneri80
 
1. SYSTEMS, ROLES, AND DEVELOPMENT METHODOLOGIES.ppt
zilow058
 
settlement FOR FOUNDATION ENGINEERS.pdf
Endalkazene
 
Victory Precisions_Supplier Profile.pptx
victoryprecisions199
 
Ad

Week-1..................................

  • 2. Week-1 Agenda  Overview of functional programming concepts  Lambda expressions  Functional interfaces  Method References
  • 3. Functional Programming Paradigm  Functional programming is a programming paradigm in which we try to bind everything in pure mathematical functions style.  It is a declarative type of programming style.  Its main focus is on “what to solve” in contrast to an imperative style where the main focus is “how to solve”.  It uses expressions instead of statements. Java – Object Oriented Programming Java 8 – Functional Programming Let’s c an example
  • 4. Java 8  Oracle released a new version of Java as Java 8 in March 18, 2014.  It includes various upgrades to the Java programming, JVM, Tools and libraries.  Java 8 is the latest release for Java that contains new features, enhancements and bug fixes to improve efficiency to develop and run Java programs.  It was a revolutionary release of the Java for software development platform
  • 5. Functional Interface:  An Interface that contains exactly one abstract method is known as functional interface.  It can have any number of default, static methods but can contain only one abstract method.  The functional interface is used to support the functional programming approach, lambda expression, and method reference as well.
  • 6. Lambda expressions:  Lambda expression is also known as an anonymous function.  It is designed to provide the implementation of a functional interface. Syntax (list of arguments) -> { expression body}  1. list of arguments can be zero, one, or more.  2. expression body can have one or more statements. Let’s c an example
  • 7. Method Reference :  Method reference is used to refer method of functional interface.  It is compact and easy form of lambda expression.  Each time when you are using lambda expression to just referring a method, you can replace your lambda expression with method reference. Types of Method References There are following types of method references.  Reference to a static method.  Reference to an instance method.  Reference to a constructor. Advantages?
  • 8. Streams API  A Java Stream is a component that is capable to perform internal operations of its elements.  For example, it can iterate its elements itself.  A stream source can be a Collection, an array, or an I/O channel. Java Example: Filtering Collection without using Stream Java Stream Example: Filtering Collection by using Stream Java Stream Example: Map Collection by using Stream Java Stream Example : reduce() Method in Collection Java Stream Iterating Example
  • 9. THANK YOU Will see in Next Class