SlideShare une entreprise Scribd logo
1  sur  29
Télécharger pour lire hors ligne
Revolution of Java
Java 8 – Project Lambda
About Me
• Java Developer
• Technical Teacher
• Blogger @kodcu.com
Java 8 Innovations

• Lambda Expressions

• Type Inference

• Metod References

• Collection II

• Defender Methods
Functional Interface ?
• An Interface includes only one abstract
  method called as FunctionalInterface


• Lambda expressions are converted to a FI’s
  implementation in Background
Functional Interface Examps.
• java.lang.Runnable
• java.util.concurrent.Callable
• java.nio.file.PathMatcher
• java.lang.reflect.InvocationHandler
• java.beans.PropertyChangeListener
• java.awt.event.ActionListener
Lambda Expressions
• Lambda -> (also called Closures), is an expression
  that reduces vertical boilerplate code.

• Concise and Clear code development practice

• Interfaces that consist of one more than abstract
  method, cannot be counterpart of any Lambda
  expressions.

   Tip: Exceptions (Defender methods & Object class’ methods)
Focus to Input & Output
Runnable r1=new Runnable() {

        @Override             Input

        public void run() {

             Output

            System.out.println(“Hello Uranus.");

        }
   };
Example
Lambda Types

• 2 type
  – Single expression // no need “return”
     • (Integer s) -> ( s*2 );
     • |or| (Integer s) -> s*2 ;



  – Statement Block
     • (Integer s) -> { return s*2; };
Type Inference

(String s) -> { System.out.println(s); };
// equals

(s) -> { System.out.println(s); };
// equals

s   -> { System.out.println(s); };
Type Inference

(Integer   a, Integer b)    -> a + b;
// equals

(a,b) -> (a+b);
Metod References
Runnable r1=new Runnable() {

        @Override             Input

        public void run() {

             Output

            System.out.println(“Hello Uranus.");

        }
   };
Metod References
Collection II
• Collection II is an attachment to existing
  Collection Framework.

• Supports Jquery like chained methods and
  Underscore.js like Functional Programming
  Experience.
Collection II
• Existing Collection Framework does not
  support Concurrent operations in
  chunked datas.

• Cause, existing one applies External
  Iteration.
Stream <T> Interface
• Sequential and Consumable data structure.

• The data cannot be fetch again after consumed.

• A Stream object can be obtained any data
  structure in Collection Framework.

• Fo.Exm: LinkedList, ArrayList, HashSet.
java.util.function
         Functional Interfaces

• Those special Interfaces
  support general data
  operations.
Consumer<T> -> Applying
• Consumer gets an input and runs an action.

• Does not return any result, only do an action.



  public void accept(T t);
Predicate<T> -> Filtering
• Predicate gets a conditional code and
  produce -> true || false

• In concise, makes filtering.


  public boolean test(T t);
Function<T, R> -> (Consume & Produce);
• Gets any type of input object and Produce an
  output object.



     public R apply(T t);
Supplier<T>
• Do not get any argument object, only returns
  instantiation of any object type.



    public T get();
Bi?
BiPredicate<L, R>    Compares two inputted object.

BiConsumer<T, U>     Consumes two type of objects, and produce no result

BiFunction<T, U, R> Gets two input object (T , U) and produce a result (R)


                                   .
                                   .
                                   .
Parallel Stream
• Any parallelizable operations can run
  concurrently with Parallel stream object.

• Parallel Stream object can be obtain with
  parallelStream() method from any Streamable
  data structure.
Lazily & Eagerly Ops.
• Some Stream operations can be run Lazly as
  some Eagerly.
         Lazy          Eager

• .filter().map().allMatch();
                Lazy            Eager

• .filter().filter().sorted().forEach();
Lazily & Eagerly
• Lazy operations are evaluated together with
  first encountered Eager operation.

• The goal is evaluate chanied operations in
  one step.
Defender Methods
• Before Java 8, Interfaces can contain only
  abstract methods.

• With Java 8, any Interface can contain one or
  more concrete methods that named
  default/defender method.

• Tip: Default methods do not break nature of F           I
                                                  onctional nterfaces
Defender Methods

• Defender Methods, Default Methods, Virtual extension methods

• Makes possible usage of concrete methods.

• Makes more elastic of Java Inheritance model.
Defender Methods
• Defender methods can be re-implemented or
  inherited by other Interfaces.
?
??
???
????
?????   Q/A
????
???
??
?

Contenu connexe

Tendances

Tendances (20)

Java8 features
Java8 featuresJava8 features
Java8 features
 
Major Java 8 features
Major Java 8 featuresMajor Java 8 features
Major Java 8 features
 
java 8 new features
java 8 new features java 8 new features
java 8 new features
 
Java 8 presentation
Java 8 presentationJava 8 presentation
Java 8 presentation
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
 
Java 8 Feature Preview
Java 8 Feature PreviewJava 8 Feature Preview
Java 8 Feature Preview
 
Java 8 Features
Java 8 FeaturesJava 8 Features
Java 8 Features
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
 
Java8
Java8Java8
Java8
 
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
 
Java SE 8 - New Features
Java SE 8 - New FeaturesJava SE 8 - New Features
Java SE 8 - New Features
 
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
 
Java 8 streams
Java 8 streamsJava 8 streams
Java 8 streams
 
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)
 
Introduction to Java 8
Introduction to Java 8Introduction to Java 8
Introduction to Java 8
 
Java 8 new features
Java 8 new featuresJava 8 new features
Java 8 new features
 
Java 8: the good parts!
Java 8: the good parts!Java 8: the good parts!
Java 8: the good parts!
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8
 
Streams in Java 8
Streams in Java 8Streams in Java 8
Streams in Java 8
 
Functional Programming In Practice
Functional Programming In PracticeFunctional Programming In Practice
Functional Programming In Practice
 

En vedette

Slideshare Power Point Sunumu
Slideshare Power Point SunumuSlideshare Power Point Sunumu
Slideshare Power Point Sunumuguest5b8685
 
SLİDESHARE NASIL KULLANILIR?
SLİDESHARE NASIL KULLANILIR?SLİDESHARE NASIL KULLANILIR?
SLİDESHARE NASIL KULLANILIR?Orkun Güren
 
Git - Bildiğiniz Gibi Değil
Git - Bildiğiniz Gibi DeğilGit - Bildiğiniz Gibi Değil
Git - Bildiğiniz Gibi DeğilLemi Orhan Ergin
 
Java Exception Handling Best Practices - Improved Second Version
Java Exception Handling Best Practices - Improved Second VersionJava Exception Handling Best Practices - Improved Second Version
Java Exception Handling Best Practices - Improved Second VersionLemi Orhan Ergin
 
Digital Sketchnotes 101
Digital Sketchnotes 101Digital Sketchnotes 101
Digital Sketchnotes 101Karen Bosch
 
Snapchat Visual Marketing Strategy
Snapchat Visual Marketing StrategySnapchat Visual Marketing Strategy
Snapchat Visual Marketing StrategyKatai Robert
 
The Sketchnote Mini-Workshop
The Sketchnote Mini-WorkshopThe Sketchnote Mini-Workshop
The Sketchnote Mini-WorkshopMike Rohde
 
Clean and green hydrocarbons ignite publish
Clean and green hydrocarbons ignite publishClean and green hydrocarbons ignite publish
Clean and green hydrocarbons ignite publishKrzysztof (Kris) Palka
 
17 Ways to Design a Presentation People Want to View
17 Ways to Design a Presentation People Want to View17 Ways to Design a Presentation People Want to View
17 Ways to Design a Presentation People Want to ViewJim MacLeod
 

En vedette (11)

Slideshare Power Point Sunumu
Slideshare Power Point SunumuSlideshare Power Point Sunumu
Slideshare Power Point Sunumu
 
Slideshare nedir
Slideshare nedirSlideshare nedir
Slideshare nedir
 
SLİDESHARE NASIL KULLANILIR?
SLİDESHARE NASIL KULLANILIR?SLİDESHARE NASIL KULLANILIR?
SLİDESHARE NASIL KULLANILIR?
 
Slideshare net
Slideshare netSlideshare net
Slideshare net
 
Git - Bildiğiniz Gibi Değil
Git - Bildiğiniz Gibi DeğilGit - Bildiğiniz Gibi Değil
Git - Bildiğiniz Gibi Değil
 
Java Exception Handling Best Practices - Improved Second Version
Java Exception Handling Best Practices - Improved Second VersionJava Exception Handling Best Practices - Improved Second Version
Java Exception Handling Best Practices - Improved Second Version
 
Digital Sketchnotes 101
Digital Sketchnotes 101Digital Sketchnotes 101
Digital Sketchnotes 101
 
Snapchat Visual Marketing Strategy
Snapchat Visual Marketing StrategySnapchat Visual Marketing Strategy
Snapchat Visual Marketing Strategy
 
The Sketchnote Mini-Workshop
The Sketchnote Mini-WorkshopThe Sketchnote Mini-Workshop
The Sketchnote Mini-Workshop
 
Clean and green hydrocarbons ignite publish
Clean and green hydrocarbons ignite publishClean and green hydrocarbons ignite publish
Clean and green hydrocarbons ignite publish
 
17 Ways to Design a Presentation People Want to View
17 Ways to Design a Presentation People Want to View17 Ways to Design a Presentation People Want to View
17 Ways to Design a Presentation People Want to View
 

Similaire à Java 8 - Project Lambda

Lambdas : Beyond The Basics
Lambdas : Beyond The BasicsLambdas : Beyond The Basics
Lambdas : Beyond The BasicsSimon Ritter
 
Automatic Migration of Legacy Java Method Implementations to Interfaces
Automatic Migration of Legacy Java Method Implementations to InterfacesAutomatic Migration of Legacy Java Method Implementations to Interfaces
Automatic Migration of Legacy Java Method Implementations to InterfacesRaffi Khatchadourian
 
The Road to Lambda - Mike Duigou
The Road to Lambda - Mike DuigouThe Road to Lambda - Mike Duigou
The Road to Lambda - Mike Duigoujaxconf
 
Charles Sharp: Java 8 Streams
Charles Sharp: Java 8 StreamsCharles Sharp: Java 8 Streams
Charles Sharp: Java 8 Streamsjessitron
 
Java tutorials
Java tutorialsJava tutorials
Java tutorialssaryu2011
 
JDK8 Lambdas and Streams: Changing The Way You Think When Developing Java
JDK8 Lambdas and Streams: Changing The Way You Think When Developing JavaJDK8 Lambdas and Streams: Changing The Way You Think When Developing Java
JDK8 Lambdas and Streams: Changing The Way You Think When Developing JavaSimon Ritter
 
Synapseindia reviews.odp.
Synapseindia reviews.odp.Synapseindia reviews.odp.
Synapseindia reviews.odp.Tarunsingh198
 
Scala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud FoundryScala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud FoundryPray Desai
 
Stream Api.pdf
Stream Api.pdfStream Api.pdf
Stream Api.pdfAkaks
 
JavaTutorials.ppt
JavaTutorials.pptJavaTutorials.ppt
JavaTutorials.pptKhizar40
 
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 RitterJAXLondon2014
 
Lambdas And Streams in JDK8
Lambdas And Streams in JDK8Lambdas And Streams in JDK8
Lambdas And Streams in JDK8Simon Ritter
 
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...Raffi Khatchadourian
 

Similaire à Java 8 - Project Lambda (20)

Lambdas in Java 8
Lambdas in Java 8Lambdas in Java 8
Lambdas in Java 8
 
Collections
CollectionsCollections
Collections
 
Lambdas and Laughs
Lambdas and LaughsLambdas and Laughs
Lambdas and Laughs
 
Java Tutorial
Java TutorialJava Tutorial
Java Tutorial
 
Lambdas : Beyond The Basics
Lambdas : Beyond The BasicsLambdas : Beyond The Basics
Lambdas : Beyond The Basics
 
Automatic Migration of Legacy Java Method Implementations to Interfaces
Automatic Migration of Legacy Java Method Implementations to InterfacesAutomatic Migration of Legacy Java Method Implementations to Interfaces
Automatic Migration of Legacy Java Method Implementations to Interfaces
 
The Road to Lambda - Mike Duigou
The Road to Lambda - Mike DuigouThe Road to Lambda - Mike Duigou
The Road to Lambda - Mike Duigou
 
Charles Sharp: Java 8 Streams
Charles Sharp: Java 8 StreamsCharles Sharp: Java 8 Streams
Charles Sharp: Java 8 Streams
 
Java 8 Intro - Core Features
Java 8 Intro - Core FeaturesJava 8 Intro - Core Features
Java 8 Intro - Core Features
 
Java tutorials
Java tutorialsJava tutorials
Java tutorials
 
08 subprograms
08 subprograms08 subprograms
08 subprograms
 
JDK8 Lambdas and Streams: Changing The Way You Think When Developing Java
JDK8 Lambdas and Streams: Changing The Way You Think When Developing JavaJDK8 Lambdas and Streams: Changing The Way You Think When Developing Java
JDK8 Lambdas and Streams: Changing The Way You Think When Developing Java
 
Synapseindia reviews.odp.
Synapseindia reviews.odp.Synapseindia reviews.odp.
Synapseindia reviews.odp.
 
Java 8
Java 8Java 8
Java 8
 
Scala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud FoundryScala, Play 2.0 & Cloud Foundry
Scala, Play 2.0 & Cloud Foundry
 
Stream Api.pdf
Stream Api.pdfStream Api.pdf
Stream Api.pdf
 
JavaTutorials.ppt
JavaTutorials.pptJavaTutorials.ppt
JavaTutorials.ppt
 
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
 
Lambdas And Streams in JDK8
Lambdas And Streams in JDK8Lambdas And Streams in JDK8
Lambdas And Streams in JDK8
 
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
 

Plus de Rahman USTA

JShell: The Ultimate Missing Tool
JShell: The Ultimate Missing ToolJShell: The Ultimate Missing Tool
JShell: The Ultimate Missing ToolRahman USTA
 
Digital Authoring with Asciidoc(tor) and AsciidocFX
Digital Authoring with Asciidoc(tor) and AsciidocFXDigital Authoring with Asciidoc(tor) and AsciidocFX
Digital Authoring with Asciidoc(tor) and AsciidocFXRahman USTA
 
JavaOne 2016 - The JCP (Java Community Process)
JavaOne 2016 - The JCP (Java Community Process)JavaOne 2016 - The JCP (Java Community Process)
JavaOne 2016 - The JCP (Java Community Process)Rahman USTA
 
Java 9 Project Jigsaw
Java 9 Project JigsawJava 9 Project Jigsaw
Java 9 Project JigsawRahman USTA
 
Java EE Nedir? (Baku JUG)
Java EE Nedir? (Baku JUG)Java EE Nedir? (Baku JUG)
Java EE Nedir? (Baku JUG)Rahman USTA
 
Java 8 Nashorn ve Avatar.js
Java 8 Nashorn ve Avatar.jsJava 8 Nashorn ve Avatar.js
Java 8 Nashorn ve Avatar.jsRahman USTA
 

Plus de Rahman USTA (6)

JShell: The Ultimate Missing Tool
JShell: The Ultimate Missing ToolJShell: The Ultimate Missing Tool
JShell: The Ultimate Missing Tool
 
Digital Authoring with Asciidoc(tor) and AsciidocFX
Digital Authoring with Asciidoc(tor) and AsciidocFXDigital Authoring with Asciidoc(tor) and AsciidocFX
Digital Authoring with Asciidoc(tor) and AsciidocFX
 
JavaOne 2016 - The JCP (Java Community Process)
JavaOne 2016 - The JCP (Java Community Process)JavaOne 2016 - The JCP (Java Community Process)
JavaOne 2016 - The JCP (Java Community Process)
 
Java 9 Project Jigsaw
Java 9 Project JigsawJava 9 Project Jigsaw
Java 9 Project Jigsaw
 
Java EE Nedir? (Baku JUG)
Java EE Nedir? (Baku JUG)Java EE Nedir? (Baku JUG)
Java EE Nedir? (Baku JUG)
 
Java 8 Nashorn ve Avatar.js
Java 8 Nashorn ve Avatar.jsJava 8 Nashorn ve Avatar.js
Java 8 Nashorn ve Avatar.js
 

Dernier

2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 

Dernier (20)

2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 

Java 8 - Project Lambda

  • 1. Revolution of Java Java 8 – Project Lambda
  • 2. About Me • Java Developer • Technical Teacher • Blogger @kodcu.com
  • 3. Java 8 Innovations • Lambda Expressions • Type Inference • Metod References • Collection II • Defender Methods
  • 4. Functional Interface ? • An Interface includes only one abstract method called as FunctionalInterface • Lambda expressions are converted to a FI’s implementation in Background
  • 5. Functional Interface Examps. • java.lang.Runnable • java.util.concurrent.Callable • java.nio.file.PathMatcher • java.lang.reflect.InvocationHandler • java.beans.PropertyChangeListener • java.awt.event.ActionListener
  • 6. Lambda Expressions • Lambda -> (also called Closures), is an expression that reduces vertical boilerplate code. • Concise and Clear code development practice • Interfaces that consist of one more than abstract method, cannot be counterpart of any Lambda expressions. Tip: Exceptions (Defender methods & Object class’ methods)
  • 7. Focus to Input & Output Runnable r1=new Runnable() { @Override Input public void run() { Output System.out.println(“Hello Uranus."); } };
  • 9. Lambda Types • 2 type – Single expression // no need “return” • (Integer s) -> ( s*2 ); • |or| (Integer s) -> s*2 ; – Statement Block • (Integer s) -> { return s*2; };
  • 10. Type Inference (String s) -> { System.out.println(s); }; // equals (s) -> { System.out.println(s); }; // equals s -> { System.out.println(s); };
  • 11. Type Inference (Integer a, Integer b) -> a + b; // equals (a,b) -> (a+b);
  • 12. Metod References Runnable r1=new Runnable() { @Override Input public void run() { Output System.out.println(“Hello Uranus."); } };
  • 14. Collection II • Collection II is an attachment to existing Collection Framework. • Supports Jquery like chained methods and Underscore.js like Functional Programming Experience.
  • 15. Collection II • Existing Collection Framework does not support Concurrent operations in chunked datas. • Cause, existing one applies External Iteration.
  • 16. Stream <T> Interface • Sequential and Consumable data structure. • The data cannot be fetch again after consumed. • A Stream object can be obtained any data structure in Collection Framework. • Fo.Exm: LinkedList, ArrayList, HashSet.
  • 17. java.util.function Functional Interfaces • Those special Interfaces support general data operations.
  • 18. Consumer<T> -> Applying • Consumer gets an input and runs an action. • Does not return any result, only do an action. public void accept(T t);
  • 19. Predicate<T> -> Filtering • Predicate gets a conditional code and produce -> true || false • In concise, makes filtering. public boolean test(T t);
  • 20. Function<T, R> -> (Consume & Produce); • Gets any type of input object and Produce an output object. public R apply(T t);
  • 21. Supplier<T> • Do not get any argument object, only returns instantiation of any object type. public T get();
  • 22. Bi? BiPredicate<L, R> Compares two inputted object. BiConsumer<T, U> Consumes two type of objects, and produce no result BiFunction<T, U, R> Gets two input object (T , U) and produce a result (R) . . .
  • 23. Parallel Stream • Any parallelizable operations can run concurrently with Parallel stream object. • Parallel Stream object can be obtain with parallelStream() method from any Streamable data structure.
  • 24. Lazily & Eagerly Ops. • Some Stream operations can be run Lazly as some Eagerly. Lazy Eager • .filter().map().allMatch(); Lazy Eager • .filter().filter().sorted().forEach();
  • 25. Lazily & Eagerly • Lazy operations are evaluated together with first encountered Eager operation. • The goal is evaluate chanied operations in one step.
  • 26. Defender Methods • Before Java 8, Interfaces can contain only abstract methods. • With Java 8, any Interface can contain one or more concrete methods that named default/defender method. • Tip: Default methods do not break nature of F I onctional nterfaces
  • 27. Defender Methods • Defender Methods, Default Methods, Virtual extension methods • Makes possible usage of concrete methods. • Makes more elastic of Java Inheritance model.
  • 28. Defender Methods • Defender methods can be re-implemented or inherited by other Interfaces.
  • 29. ? ?? ??? ???? ????? Q/A ???? ??? ?? ?