SlideShare una empresa de Scribd logo
1 de 34
Descargar para leer sin conexión
JSR 335:
                             λ
Project Lambda
François Sarradin -- Xebia
Java Roadmap
               337
 Java 7     JSR Java 8
jul. 2011      aug. 2013                    Java 9
                                              ?


              Modularity
            Performance ●     FP / Parallel comp.
             Productivity ●   Date API improv.
                          ●   Type annotation
                          ●   Compact profiles
                          ●   Nashorn
Project Lambda
What's in it?
                    Project
                    Lambda
                      JSR335


                                        Virtual Extension
Lambda Expression
                                             Method


                  Collection API         Collection API
Functional API
                 Parallel Collections    Bulk Operations
Question


     What will be the impact
        of Project Lambda
        on the Java world?
Answer
Look at Speed Car!
Planning...
Presentation + live coding (free to interrupt)

● Genesis
● Lambda of Java
● Project Lambda
...And Then
● Debate

● Retrospective (agile style!)

● Report
   ○ Xebia blog
   ○ Project Lambda ML
Genesis
More Processors
More Expressiveness
More Readability

   结果 汉字 = new 物().処理();
             vs.
  fact n = product [1..n]


           Is it all Chinese to you?
FP & Competition


    Clojure
                   C++
          C# / F#
               Guava
(Anonymous) Inner Class
A λ Solution

Iterables.filter(persons,
 new Predicate<Person>() {

  @Override
  public boolean apply(Person person) {
    return person.getAge() >= 18;
  }

}); // Java + Guava
(Anonymous) Inner Class
A (better?) λ Solution
Iterables.filter(persons, IS_ADULT);

Predicate<Person> IS_ADULT
   = new Predicate<Person>() {

  @Override
  public boolean apply(Person person) {
    return person.getAge() >= 18;
  }

});
                    This is what you really need!
(Anonymous) Inner Class
(Not Really) A λ Solution

● "The pain of anonymous inner classes makes us roll
  our eyes in the back of our heads every day." (a wise
  Oracle's client, 01/2011)



       Average length of Java one-liner is 21 line!
       @DEVOPS_BORAT - 12/09/2011
What about Oracle?


● "It’s time to add closures to Java" (Mark Reinhold,
   12/2009)

● "Oracle's position is that Java must evolve -- carefully,
   of course -- in order to remain competitive." (Brian
   Goetz - 08/2011)
Lambda of Java
Here is the λ!

(int x, int y) -> { return x + y; }
(x, y) -> { return x + y; }
(int x, int y) -> x + y


        (x, y) -> x + y
Other λ forms

x   -> 2 * x

() -> 42

m   -> {
    m.put("France", "Paris");
    m.put("UK", "London");
    m.put("USA", "Washington");
}
Inner Class
vs. λ Solution
Iterables.filter(persons,
 new Predicate<Person>() {
   @Override
   public boolean apply(Person p) {
     return p.getAge() >= 18;
   }
}); // Java 5-7 + Guava


Iterables.filter(persons, // Java 8 + Guava
     p -> p.getAge() >= 18);
Method Reference

String::valueOf
// like: v -> String.valueOf(v)

Integer::compare
// like: (i1, i2) -> Integer.compare(i1, i2)



Arrays.sort(myInts, Integer::compare)
Virtual Extension Method
    (VEM)

interface Message {

    String getMessage() default {
      return "Look Ma'! Interface with code!";
    }

}
VEM
Motivation
 VEM
                              eg. Collection API

       Help to extend existing APIs


       Minimize rewrite of existing
       API implementation

                            eg. Hibernate Collection
                            Implementation
Collection API Extended


  java.util.functions.*
  java.util.streams.*
  Extension of Iterable, Iterator, Collection, Map, ...
  java.util.Optional
Parallel Computing
As Easy as 1-2-3?

myCollection.stream()
   .filter(x -> ...)
   .map(x -> ...)
   .reduce((x, y) -> ...) // sequential


myCollection.parallel()
   .filter(x -> ...)
   .map(x -> ...)
   .reduce((x, y) -> ...) // parallel
Some kata and demos...
Project Lambda
The Dream Team ;)




                    photo: @crazybob
Web Sites

JSR335
http://jcp.org/en/jsr/detail?id=335



OpenJDK 8 Web site
http://openjdk.java.net/projects/lambda/
Where to Get Java 8


Java SE 8 Early Access (with lambda)
http://jdk8.java.net/lambda/


Mercurial repo
http://hg.openjdk.java.net/lambda/lambda
Mailing Lists
Technical Discussion
mailto:lambda-dev@openjdk.java.net
http://mail.openjdk.java.net/pipermail/lambda-dev/


Libs Spec Discussion
http://mail.openjdk.java.net/pipermail/lambda-libs-spec-<*>/


Spec Discussion
http://mail.openjdk.java.net/pipermail/lambda-spec-<*>/
Around Project Lambda

OpenJDK OSX Build (7 & 8)
http://code.google.com/p/openjdk-osx-build/

                                                             H. Gomez




Java 8 vs Scala: a Feature
Comparison
http://www.infoq.com/articles/java-8-vs-scala
                                                S. van den Berg
                                                                  U. Peter
Around Project Lambda
In France

JDK 8: lambdas in Action [FR]
http://www.devoxx.                                     O. Croisier
com/display/FR12/JDK+8+demo++lambdas+in
+Action
                                           G. Tardif

Java 8 et les Lambda [FR]
http://thecodersbreakfast.net/index.php?
post/2012/05/30/Java-8-et-les-Lambda

Curious about Project Lambda ;)
http://blog.xebia.fr/ [FR]
http://kerflyn.wordpress.com/                          Guess
                                                       Who?
Project Lambda
and the Community
● Transparency
  ○ Presentations / Publications
  ○ Source code available


● Early testing by community
  ○ Pre-version available
  ○ AdoptOpenJDK (http://java.
     net/projects/adoptopenjdk/pages/AdoptOpenJDK)


● Quick feedback
  ○ ML, Hackdays
Question
● Oneliner, Readability, and Debugability

● Java vs. Competitors

● What to do for Java 8 to be adopted in
  projects?

● Is there a future for Java?

Más contenido relacionado

La actualidad más candente

Scala - The Simple Parts, SFScala presentation
Scala - The Simple Parts, SFScala presentationScala - The Simple Parts, SFScala presentation
Scala - The Simple Parts, SFScala presentationMartin Odersky
 
Introduction To Grails
Introduction To GrailsIntroduction To Grails
Introduction To GrailsEric Berry
 
Introduction to Koltin for Android Part I
Introduction to Koltin for Android Part I Introduction to Koltin for Android Part I
Introduction to Koltin for Android Part I Atif AbbAsi
 
Why Scala for Web 2.0?
Why Scala for Web 2.0?Why Scala for Web 2.0?
Why Scala for Web 2.0?Alex Payne
 
A Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to ScalaA Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to ScalaDerek Chen-Becker
 
Functional programming in scala
Functional programming in scalaFunctional programming in scala
Functional programming in scalaStratio
 
FregeDay: Design and Implementation of the language (Ingo Wechsung)
FregeDay: Design and Implementation of the language (Ingo Wechsung)FregeDay: Design and Implementation of the language (Ingo Wechsung)
FregeDay: Design and Implementation of the language (Ingo Wechsung)Dierk König
 
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mindScala: functional programming for the imperative mind
Scala: functional programming for the imperative mindSander Mak (@Sander_Mak)
 
An Introduction to Scala - Blending OO and Functional Paradigms
An Introduction to Scala - Blending OO and Functional ParadigmsAn Introduction to Scala - Blending OO and Functional Paradigms
An Introduction to Scala - Blending OO and Functional ParadigmsMiles Sabin
 
Functional programming in Scala
Functional programming in ScalaFunctional programming in Scala
Functional programming in Scaladatamantra
 
10 Things I Hate About Scala
10 Things I Hate About Scala10 Things I Hate About Scala
10 Things I Hate About ScalaMeir Maor
 
Lightning talk: Kotlin
Lightning talk: KotlinLightning talk: Kotlin
Lightning talk: KotlinEvolve
 
Exploring Kotlin language basics for Android App development
Exploring Kotlin language basics for Android App developmentExploring Kotlin language basics for Android App development
Exploring Kotlin language basics for Android App developmentJayaprakash R
 
Functional programming with Java 8
Functional programming with Java 8Functional programming with Java 8
Functional programming with Java 8LivePerson
 
Programming Android Application in Scala.
Programming Android Application in Scala.Programming Android Application in Scala.
Programming Android Application in Scala.Brian Hsu
 

La actualidad más candente (20)

Scala - The Simple Parts, SFScala presentation
Scala - The Simple Parts, SFScala presentationScala - The Simple Parts, SFScala presentation
Scala - The Simple Parts, SFScala presentation
 
Introduction To Grails
Introduction To GrailsIntroduction To Grails
Introduction To Grails
 
Introduction to Koltin for Android Part I
Introduction to Koltin for Android Part I Introduction to Koltin for Android Part I
Introduction to Koltin for Android Part I
 
Why Scala for Web 2.0?
Why Scala for Web 2.0?Why Scala for Web 2.0?
Why Scala for Web 2.0?
 
Applicative style programming
Applicative style programmingApplicative style programming
Applicative style programming
 
A Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to ScalaA Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to Scala
 
JDKs 10 to 14 (and beyond)
JDKs 10 to 14 (and beyond)JDKs 10 to 14 (and beyond)
JDKs 10 to 14 (and beyond)
 
Functional programming in scala
Functional programming in scalaFunctional programming in scala
Functional programming in scala
 
FregeDay: Design and Implementation of the language (Ingo Wechsung)
FregeDay: Design and Implementation of the language (Ingo Wechsung)FregeDay: Design and Implementation of the language (Ingo Wechsung)
FregeDay: Design and Implementation of the language (Ingo Wechsung)
 
Scala: functional programming for the imperative mind
Scala: functional programming for the imperative mindScala: functional programming for the imperative mind
Scala: functional programming for the imperative mind
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Scala Jump Start
Scala Jump StartScala Jump Start
Scala Jump Start
 
An Introduction to Scala - Blending OO and Functional Paradigms
An Introduction to Scala - Blending OO and Functional ParadigmsAn Introduction to Scala - Blending OO and Functional Paradigms
An Introduction to Scala - Blending OO and Functional Paradigms
 
Functional programming in Scala
Functional programming in ScalaFunctional programming in Scala
Functional programming in Scala
 
Scala
ScalaScala
Scala
 
10 Things I Hate About Scala
10 Things I Hate About Scala10 Things I Hate About Scala
10 Things I Hate About Scala
 
Lightning talk: Kotlin
Lightning talk: KotlinLightning talk: Kotlin
Lightning talk: Kotlin
 
Exploring Kotlin language basics for Android App development
Exploring Kotlin language basics for Android App developmentExploring Kotlin language basics for Android App development
Exploring Kotlin language basics for Android App development
 
Functional programming with Java 8
Functional programming with Java 8Functional programming with Java 8
Functional programming with Java 8
 
Programming Android Application in Scala.
Programming Android Application in Scala.Programming Android Application in Scala.
Programming Android Application in Scala.
 

Similar a Java 8 Lambda

New features in jdk8 iti
New features in jdk8 itiNew features in jdk8 iti
New features in jdk8 itiAhmed mar3y
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller ColumnsJonathan Fine
 
Introduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and StreamsIntroduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and StreamsEmiel Paasschens
 
Develop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumDevelop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumNgoc Dao
 
Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part IIEugene Lazutkin
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011YoungSu Son
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScriptJorg Janke
 
EU projects MODAClouds and JUNIPER – Writing and testing transformations from...
EU projects MODAClouds and JUNIPER – Writing and testing transformations from...EU projects MODAClouds and JUNIPER – Writing and testing transformations from...
EU projects MODAClouds and JUNIPER – Writing and testing transformations from...Marcos Almeida
 
Java 7 - New Features - by Mihail Stoynov and Svetlin Nakov
Java 7 - New Features - by Mihail Stoynov and Svetlin NakovJava 7 - New Features - by Mihail Stoynov and Svetlin Nakov
Java 7 - New Features - by Mihail Stoynov and Svetlin NakovSvetlin Nakov
 
Java World, Java Trends, Java 8 and Beyond (iForum - 2014)
Java World, Java Trends, Java 8 and Beyond (iForum - 2014)Java World, Java Trends, Java 8 and Beyond (iForum - 2014)
Java World, Java Trends, Java 8 and Beyond (iForum - 2014)Olena Syrota
 
The curious Life of JavaScript - Talk at SI-SE 2015
The curious Life of JavaScript - Talk at SI-SE 2015The curious Life of JavaScript - Talk at SI-SE 2015
The curious Life of JavaScript - Talk at SI-SE 2015jbandi
 
Alberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsAlberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsScala Italy
 
Scala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJSScala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJSAlberto Paro
 

Similar a Java 8 Lambda (20)

Developing android apps with java 8
Developing android apps with java 8Developing android apps with java 8
Developing android apps with java 8
 
What`s New in Java 8
What`s New in Java 8What`s New in Java 8
What`s New in Java 8
 
Java 8 Overview
Java 8 OverviewJava 8 Overview
Java 8 Overview
 
New features in jdk8 iti
New features in jdk8 itiNew features in jdk8 iti
New features in jdk8 iti
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller Columns
 
Introduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and StreamsIntroduction of Java 8 with emphasis on Lambda Expressions and Streams
Introduction of Java 8 with emphasis on Lambda Expressions and Streams
 
Functional java 8
Functional java 8Functional java 8
Functional java 8
 
Develop realtime web with Scala and Xitrum
Develop realtime web with Scala and XitrumDevelop realtime web with Scala and Xitrum
Develop realtime web with Scala and Xitrum
 
Scala vs java 8
Scala vs java 8Scala vs java 8
Scala vs java 8
 
Exciting JavaScript - Part II
Exciting JavaScript - Part IIExciting JavaScript - Part II
Exciting JavaScript - Part II
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
 
EU projects MODAClouds and JUNIPER – Writing and testing transformations from...
EU projects MODAClouds and JUNIPER – Writing and testing transformations from...EU projects MODAClouds and JUNIPER – Writing and testing transformations from...
EU projects MODAClouds and JUNIPER – Writing and testing transformations from...
 
Java 7 - New Features - by Mihail Stoynov and Svetlin Nakov
Java 7 - New Features - by Mihail Stoynov and Svetlin NakovJava 7 - New Features - by Mihail Stoynov and Svetlin Nakov
Java 7 - New Features - by Mihail Stoynov and Svetlin Nakov
 
Java World, Java Trends, Java 8 and Beyond (iForum - 2014)
Java World, Java Trends, Java 8 and Beyond (iForum - 2014)Java World, Java Trends, Java 8 and Beyond (iForum - 2014)
Java World, Java Trends, Java 8 and Beyond (iForum - 2014)
 
Jet presentation
Jet presentationJet presentation
Jet presentation
 
Preparing for Scala 3
Preparing for Scala 3Preparing for Scala 3
Preparing for Scala 3
 
The curious Life of JavaScript - Talk at SI-SE 2015
The curious Life of JavaScript - Talk at SI-SE 2015The curious Life of JavaScript - Talk at SI-SE 2015
The curious Life of JavaScript - Talk at SI-SE 2015
 
Alberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsAlberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.js
 
Scala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJSScala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJS
 

Último

Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 

Último (20)

Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 

Java 8 Lambda

  • 1. JSR 335: λ Project Lambda François Sarradin -- Xebia
  • 2. Java Roadmap 337 Java 7 JSR Java 8 jul. 2011 aug. 2013 Java 9 ? Modularity Performance ● FP / Parallel comp. Productivity ● Date API improv. ● Type annotation ● Compact profiles ● Nashorn
  • 3. Project Lambda What's in it? Project Lambda JSR335 Virtual Extension Lambda Expression Method Collection API Collection API Functional API Parallel Collections Bulk Operations
  • 4. Question What will be the impact of Project Lambda on the Java world?
  • 6. Planning... Presentation + live coding (free to interrupt) ● Genesis ● Lambda of Java ● Project Lambda
  • 7. ...And Then ● Debate ● Retrospective (agile style!) ● Report ○ Xebia blog ○ Project Lambda ML
  • 10. More Expressiveness More Readability 结果 汉字 = new 物().処理(); vs. fact n = product [1..n] Is it all Chinese to you?
  • 11. FP & Competition Clojure C++ C# / F# Guava
  • 12. (Anonymous) Inner Class A λ Solution Iterables.filter(persons, new Predicate<Person>() { @Override public boolean apply(Person person) { return person.getAge() >= 18; } }); // Java + Guava
  • 13. (Anonymous) Inner Class A (better?) λ Solution Iterables.filter(persons, IS_ADULT); Predicate<Person> IS_ADULT = new Predicate<Person>() { @Override public boolean apply(Person person) { return person.getAge() >= 18; } }); This is what you really need!
  • 14. (Anonymous) Inner Class (Not Really) A λ Solution ● "The pain of anonymous inner classes makes us roll our eyes in the back of our heads every day." (a wise Oracle's client, 01/2011) Average length of Java one-liner is 21 line! @DEVOPS_BORAT - 12/09/2011
  • 15. What about Oracle? ● "It’s time to add closures to Java" (Mark Reinhold, 12/2009) ● "Oracle's position is that Java must evolve -- carefully, of course -- in order to remain competitive." (Brian Goetz - 08/2011)
  • 17. Here is the λ! (int x, int y) -> { return x + y; } (x, y) -> { return x + y; } (int x, int y) -> x + y (x, y) -> x + y
  • 18. Other λ forms x -> 2 * x () -> 42 m -> { m.put("France", "Paris"); m.put("UK", "London"); m.put("USA", "Washington"); }
  • 19. Inner Class vs. λ Solution Iterables.filter(persons, new Predicate<Person>() { @Override public boolean apply(Person p) { return p.getAge() >= 18; } }); // Java 5-7 + Guava Iterables.filter(persons, // Java 8 + Guava p -> p.getAge() >= 18);
  • 20. Method Reference String::valueOf // like: v -> String.valueOf(v) Integer::compare // like: (i1, i2) -> Integer.compare(i1, i2) Arrays.sort(myInts, Integer::compare)
  • 21. Virtual Extension Method (VEM) interface Message { String getMessage() default { return "Look Ma'! Interface with code!"; } }
  • 22. VEM Motivation VEM eg. Collection API Help to extend existing APIs Minimize rewrite of existing API implementation eg. Hibernate Collection Implementation
  • 23. Collection API Extended java.util.functions.* java.util.streams.* Extension of Iterable, Iterator, Collection, Map, ... java.util.Optional
  • 24. Parallel Computing As Easy as 1-2-3? myCollection.stream() .filter(x -> ...) .map(x -> ...) .reduce((x, y) -> ...) // sequential myCollection.parallel() .filter(x -> ...) .map(x -> ...) .reduce((x, y) -> ...) // parallel
  • 25. Some kata and demos...
  • 27. The Dream Team ;) photo: @crazybob
  • 28. Web Sites JSR335 http://jcp.org/en/jsr/detail?id=335 OpenJDK 8 Web site http://openjdk.java.net/projects/lambda/
  • 29. Where to Get Java 8 Java SE 8 Early Access (with lambda) http://jdk8.java.net/lambda/ Mercurial repo http://hg.openjdk.java.net/lambda/lambda
  • 30. Mailing Lists Technical Discussion mailto:lambda-dev@openjdk.java.net http://mail.openjdk.java.net/pipermail/lambda-dev/ Libs Spec Discussion http://mail.openjdk.java.net/pipermail/lambda-libs-spec-<*>/ Spec Discussion http://mail.openjdk.java.net/pipermail/lambda-spec-<*>/
  • 31. Around Project Lambda OpenJDK OSX Build (7 & 8) http://code.google.com/p/openjdk-osx-build/ H. Gomez Java 8 vs Scala: a Feature Comparison http://www.infoq.com/articles/java-8-vs-scala S. van den Berg U. Peter
  • 32. Around Project Lambda In France JDK 8: lambdas in Action [FR] http://www.devoxx. O. Croisier com/display/FR12/JDK+8+demo++lambdas+in +Action G. Tardif Java 8 et les Lambda [FR] http://thecodersbreakfast.net/index.php? post/2012/05/30/Java-8-et-les-Lambda Curious about Project Lambda ;) http://blog.xebia.fr/ [FR] http://kerflyn.wordpress.com/ Guess Who?
  • 33. Project Lambda and the Community ● Transparency ○ Presentations / Publications ○ Source code available ● Early testing by community ○ Pre-version available ○ AdoptOpenJDK (http://java. net/projects/adoptopenjdk/pages/AdoptOpenJDK) ● Quick feedback ○ ML, Hackdays
  • 34. Question ● Oneliner, Readability, and Debugability ● Java vs. Competitors ● What to do for Java 8 to be adopted in projects? ● Is there a future for Java?