SlideShare une entreprise Scribd logo
1  sur  15
Hidetomo Moriomoto
http://github.com/mocchidesu
2014/05/05
* Brief history of Java
*What's new in Java 8
*Why Lambda?
* Sample Program &&
Bench mark
James Gosling: Father of Java
Date Version Highlights
1991 Oak by James Gosling@Sun
Microsystems
Named after oak tree stood
outside his office. For small
PDA device. Slight flavor of C
1996 Jan 23 JDK 1.0 “Oak” sounds similar to “awk”?
1997 Java 1.1 JDBC, reflection, JIT compiler
1998 Java2 (J2SE) Collection framework,
Swing(GUI)API
2000 Java 1.3 JNDI, RMI
2002 Feb. Java 1.4 Regex, JAXP
2004 Sept. Java 1.5 Generics, annotation, enum,
concurrency, varargs
2006 Dec. Java 1.6 Performance tune, JDBC4
2011 July Java 1.7 JVM support dynamic language
Features
DateTime API (no more new Date(), Calendar.getInstance()!)
Nashborn JavaScript engine ($JAVA_HOME/bin/jjs)
Default method in Interface / Improved concurrent package /
Optional
Lambda expressions
@FunctionalInterface annotations
Method Reference
java.util.Stream package
Backward Compatibility
Binary compatibility && Behavioral compatibility - Excellent
Source compatibility - Good
Lambda is a syntax that produces instance of
Functional Interface.
Functional Interface is:
Interface that has exactly one abstract method
- Runnable ( run() )
- Comparator (compare() )
See
@FunctionalInterface (java.lang.annotation)
List of interface under java.util.function package
You can define your own interface, of course.
 Leap to functional language (Haskell, Erlang,
JavaScript, Lisp, Scala, Ocaml, etc.)
 Single-method interface (syntax sugar)
 Provide a path to multicore (stream vs.
parallel stream) -> see demo.
 No more for loop (internal loop vs. external
loop)
In short … function is the 1st level Object
/*
* JavaScript can pass method as a parameter.
*/
var doSomething = function(name){
console.log(name + "is going to do something someday");
}
function useSomething(func, param){
func(param);
}
Event handler
(parameter) -> { // do something} ; // that’s it!
Further simplify with “Type interface” - best guess
@FunctionalInterface
private interface HelloWorld{
public String hello(String name);
}
Old anonymous class
HelloWorld hello = new HelloWorld() {
@Override
public String hello(String name) {
return "Hello, " + name;
}
};
Ex 1) -> Get Simplified with Lambda (You don’t need to specify method name)
(String name) -> { return “Hello “+name + “!!”; };
Ex 2) Remove String -> JVM best guess – type interface
(name) -> { return “Hello “+name+”!!”; };
Ex 3) Remove return – type interface
(name) -> { “Hello “+name+”!!”; };
Ex 4) Remove brackets for single implementation.
(name) -> “Hello “+name+”!!”;
Ex 5) Remove () if parameter is one
name -> “Hello “+name+”!!”;
(name -> “Hello “+name+”!!”;
 Start with .stream(), chain with intermediate
operators, end with terminal operator.
 IntermediateOperator
(filter, map, sorted, distinct, limit)
 Terminal Operator
(forEach, collect, reduce, iterator)
 listOfSomething.stream()
.filter( element -> element.age > 30) //
.map( ) // not evaluated
.sorted() // not evaluated
.limit() // not evaluated
….
.collect( Collectors.toList() );  Finally evaluate
Sample Code (Run com.hidetomo.Java8StreamBench.main)
https://github.com/mocchidesu/Java8sample.git
Input: 100,000 last name from HSA
Do:
Filter: Last name start with ‘m’
Map: (Brace each name with [] bracket)
Sort: Reverse order
Dedupe
Limit to top 2 results
Loop 1000 times.
Traditional Java7 For Loop approach vs. Sequential
Lambda vs. Parallel Lambda. -> IntelliJ13
 Java 8 is backward compatible in binary level
 Lambda is not only a syntax sugar
 It’s a new era of Java
 Performance gain?Will be improved. Stay
tuned.
 When use? NOW
Everything about Java 8
http://www.techempower.com/blog/2013/03/26/everything-about-java-8/
Oracle Compatibility Guide for JDK 8
http://www.oracle.com/technetwork/java/javase/8-compatibility-guide-
2156366.html
Lambda Peek under the Hood by Brian Goetz - Java One 2013
http://www.slideshare.net/jaxlondon2012/lambda-a-peek-under-the-hood-brian-
goetz
10 Example of Lambda Expressions and Streams in Java 8
http://javarevisited.blogspot.com/2014/02/10-example-of-lambda-expressions-in-
java8.html
 Github.com/hidetomo/java8sample.git
 Slideshare /hidetomomorimoto

Contenu connexe

Tendances

ES2015 (ES6) Overview
ES2015 (ES6) OverviewES2015 (ES6) Overview
ES2015 (ES6) Overviewhesher
 
ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]Guillermo Paz
 
Clojure and the Web
Clojure and the WebClojure and the Web
Clojure and the Webnickmbailey
 
Building a java tracer
Building a java tracerBuilding a java tracer
Building a java tracerrahulrevo
 
Nick Sieger JRuby Concurrency EMRubyConf 2011
Nick Sieger JRuby Concurrency EMRubyConf 2011Nick Sieger JRuby Concurrency EMRubyConf 2011
Nick Sieger JRuby Concurrency EMRubyConf 2011Nick Sieger
 
모던자바의 역습
모던자바의 역습모던자바의 역습
모던자바의 역습DoHyun Jung
 
JSR 172: XML Parsing in MIDP
JSR 172: XML Parsing in MIDPJSR 172: XML Parsing in MIDP
JSR 172: XML Parsing in MIDPJussi Pohjolainen
 
Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Anton Arhipov
 
Explaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to ComeExplaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to ComeCory Forsyth
 
Ruby on Rails Oracle adaptera izstrāde
Ruby on Rails Oracle adaptera izstrādeRuby on Rails Oracle adaptera izstrāde
Ruby on Rails Oracle adaptera izstrādeRaimonds Simanovskis
 
ゼロから始めるScalaプロジェクト
ゼロから始めるScalaプロジェクトゼロから始めるScalaプロジェクト
ゼロから始めるScalaプロジェクトRyuichi ITO
 
Hacking Mac OSX Cocoa API from Perl
Hacking Mac OSX Cocoa API from PerlHacking Mac OSX Cocoa API from Perl
Hacking Mac OSX Cocoa API from Perltypester
 
The Art of JVM Profiling
The Art of JVM ProfilingThe Art of JVM Profiling
The Art of JVM ProfilingAndrei Pangin
 

Tendances (20)

ORMs in Golang
ORMs in GolangORMs in Golang
ORMs in Golang
 
ES2015 (ES6) Overview
ES2015 (ES6) OverviewES2015 (ES6) Overview
ES2015 (ES6) Overview
 
ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]
 
Clojure and the Web
Clojure and the WebClojure and the Web
Clojure and the Web
 
Building a java tracer
Building a java tracerBuilding a java tracer
Building a java tracer
 
Seeking Clojure
Seeking ClojureSeeking Clojure
Seeking Clojure
 
Nick Sieger JRuby Concurrency EMRubyConf 2011
Nick Sieger JRuby Concurrency EMRubyConf 2011Nick Sieger JRuby Concurrency EMRubyConf 2011
Nick Sieger JRuby Concurrency EMRubyConf 2011
 
모던자바의 역습
모던자바의 역습모던자바의 역습
모던자바의 역습
 
JSR 172: XML Parsing in MIDP
JSR 172: XML Parsing in MIDPJSR 172: XML Parsing in MIDP
JSR 172: XML Parsing in MIDP
 
NIO and NIO2
NIO and NIO2NIO and NIO2
NIO and NIO2
 
ES6: Features + Rails
ES6: Features + RailsES6: Features + Rails
ES6: Features + Rails
 
What`s new in Java 7
What`s new in Java 7What`s new in Java 7
What`s new in Java 7
 
Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012Mastering Java Bytecode With ASM - 33rd degree, 2012
Mastering Java Bytecode With ASM - 33rd degree, 2012
 
Explaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to ComeExplaining ES6: JavaScript History and What is to Come
Explaining ES6: JavaScript History and What is to Come
 
Ruby on Rails Oracle adaptera izstrāde
Ruby on Rails Oracle adaptera izstrādeRuby on Rails Oracle adaptera izstrāde
Ruby on Rails Oracle adaptera izstrāde
 
ゼロから始めるScalaプロジェクト
ゼロから始めるScalaプロジェクトゼロから始めるScalaプロジェクト
ゼロから始めるScalaプロジェクト
 
Hacking Mac OSX Cocoa API from Perl
Hacking Mac OSX Cocoa API from PerlHacking Mac OSX Cocoa API from Perl
Hacking Mac OSX Cocoa API from Perl
 
Mastering Java ByteCode
Mastering Java ByteCodeMastering Java ByteCode
Mastering Java ByteCode
 
The Art of JVM Profiling
The Art of JVM ProfilingThe Art of JVM Profiling
The Art of JVM Profiling
 
Shell script-sec
Shell script-secShell script-sec
Shell script-sec
 

En vedette

En vedette (10)

Web quest final
Web quest finalWeb quest final
Web quest final
 
Silabo abril agosto 2016 sicoa 2
Silabo abril agosto 2016 sicoa 2Silabo abril agosto 2016 sicoa 2
Silabo abril agosto 2016 sicoa 2
 
Her Hyundai has 5 seats. 2 in the front, 3 in the back.
Her Hyundai has 5 seats. 2 in the front, 3 in the back.Her Hyundai has 5 seats. 2 in the front, 3 in the back.
Her Hyundai has 5 seats. 2 in the front, 3 in the back.
 
Orient localiz
Orient localizOrient localiz
Orient localiz
 
9
99
9
 
12
1212
12
 
Nodejs on 02/22/2012
Nodejs on 02/22/2012Nodejs on 02/22/2012
Nodejs on 02/22/2012
 
13
1313
13
 
7
77
7
 
Aspectos preliminares
Aspectos preliminaresAspectos preliminares
Aspectos preliminares
 

Similaire à Java 8 briefing

JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
Java Intro
Java IntroJava Intro
Java Introbackdoor
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevMattias Karlsson
 
LyonJUG : Comment Jigsaw est prêt à tuer le classpath
LyonJUG : Comment Jigsaw est prêt à tuer le classpathLyonJUG : Comment Jigsaw est prêt à tuer le classpath
LyonJUG : Comment Jigsaw est prêt à tuer le classpathAlexis Hassler
 
LyonJUG : Comment Jigsaw est prêt à tuer le classpath
LyonJUG : Comment Jigsaw est prêt à tuer le classpath LyonJUG : Comment Jigsaw est prêt à tuer le classpath
LyonJUG : Comment Jigsaw est prêt à tuer le classpath Alexis Hassler
 
A brief tour of modern Java
A brief tour of modern JavaA brief tour of modern Java
A brief tour of modern JavaSina Madani
 
Xml Java
Xml JavaXml Java
Xml Javacbee48
 
2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Ws2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Wsloffenauer
 
Модерни езици за програмиране за JVM (2011)
Модерни езици за програмиране за JVM (2011)Модерни езици за програмиране за JVM (2011)
Модерни езици за програмиране за JVM (2011)Bozhidar Batsov
 
Pure Java RAD and Scaffolding Tools Race
Pure Java RAD and Scaffolding Tools RacePure Java RAD and Scaffolding Tools Race
Pure Java RAD and Scaffolding Tools RaceBaruch Sadogursky
 
Clojure - A new Lisp
Clojure - A new LispClojure - A new Lisp
Clojure - A new Lispelliando dias
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)Pavlo Baron
 
Java 7 Language Enhancement
Java 7 Language EnhancementJava 7 Language Enhancement
Java 7 Language Enhancementmuthusvm
 
From Java To Clojure (English version)
From Java To Clojure (English version)From Java To Clojure (English version)
From Java To Clojure (English version)Kent Ohashi
 

Similaire à Java 8 briefing (20)

JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
Java Intro
Java IntroJava Intro
Java Intro
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
 
LyonJUG : Comment Jigsaw est prêt à tuer le classpath
LyonJUG : Comment Jigsaw est prêt à tuer le classpathLyonJUG : Comment Jigsaw est prêt à tuer le classpath
LyonJUG : Comment Jigsaw est prêt à tuer le classpath
 
LyonJUG : Comment Jigsaw est prêt à tuer le classpath
LyonJUG : Comment Jigsaw est prêt à tuer le classpath LyonJUG : Comment Jigsaw est prêt à tuer le classpath
LyonJUG : Comment Jigsaw est prêt à tuer le classpath
 
A brief tour of modern Java
A brief tour of modern JavaA brief tour of modern Java
A brief tour of modern Java
 
55 New Features in Java 7
55 New Features in Java 755 New Features in Java 7
55 New Features in Java 7
 
Xml Java
Xml JavaXml Java
Xml Java
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Ws2007 09 10 Fzi Training Groovy Grails V Ws
2007 09 10 Fzi Training Groovy Grails V Ws
 
Модерни езици за програмиране за JVM (2011)
Модерни езици за програмиране за JVM (2011)Модерни езици за програмиране за JVM (2011)
Модерни езици за програмиране за JVM (2011)
 
wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?
 
Project Coin
Project CoinProject Coin
Project Coin
 
Pure Java RAD and Scaffolding Tools Race
Pure Java RAD and Scaffolding Tools RacePure Java RAD and Scaffolding Tools Race
Pure Java RAD and Scaffolding Tools Race
 
Clojure - A new Lisp
Clojure - A new LispClojure - A new Lisp
Clojure - A new Lisp
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)
 
Scala
ScalaScala
Scala
 
Java 7 Language Enhancement
Java 7 Language EnhancementJava 7 Language Enhancement
Java 7 Language Enhancement
 
Beyond java8
Beyond java8Beyond java8
Beyond java8
 
From Java To Clojure (English version)
From Java To Clojure (English version)From Java To Clojure (English version)
From Java To Clojure (English version)
 

Dernier

New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 

Dernier (20)

DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 

Java 8 briefing

  • 2. * Brief history of Java *What's new in Java 8 *Why Lambda? * Sample Program && Bench mark James Gosling: Father of Java
  • 3. Date Version Highlights 1991 Oak by James Gosling@Sun Microsystems Named after oak tree stood outside his office. For small PDA device. Slight flavor of C 1996 Jan 23 JDK 1.0 “Oak” sounds similar to “awk”? 1997 Java 1.1 JDBC, reflection, JIT compiler 1998 Java2 (J2SE) Collection framework, Swing(GUI)API 2000 Java 1.3 JNDI, RMI 2002 Feb. Java 1.4 Regex, JAXP 2004 Sept. Java 1.5 Generics, annotation, enum, concurrency, varargs 2006 Dec. Java 1.6 Performance tune, JDBC4 2011 July Java 1.7 JVM support dynamic language
  • 4. Features DateTime API (no more new Date(), Calendar.getInstance()!) Nashborn JavaScript engine ($JAVA_HOME/bin/jjs) Default method in Interface / Improved concurrent package / Optional Lambda expressions @FunctionalInterface annotations Method Reference java.util.Stream package Backward Compatibility Binary compatibility && Behavioral compatibility - Excellent Source compatibility - Good
  • 5. Lambda is a syntax that produces instance of Functional Interface.
  • 6. Functional Interface is: Interface that has exactly one abstract method - Runnable ( run() ) - Comparator (compare() ) See @FunctionalInterface (java.lang.annotation) List of interface under java.util.function package You can define your own interface, of course.
  • 7.  Leap to functional language (Haskell, Erlang, JavaScript, Lisp, Scala, Ocaml, etc.)  Single-method interface (syntax sugar)  Provide a path to multicore (stream vs. parallel stream) -> see demo.  No more for loop (internal loop vs. external loop)
  • 8. In short … function is the 1st level Object /* * JavaScript can pass method as a parameter. */ var doSomething = function(name){ console.log(name + "is going to do something someday"); } function useSomething(func, param){ func(param); } Event handler
  • 9. (parameter) -> { // do something} ; // that’s it! Further simplify with “Type interface” - best guess @FunctionalInterface private interface HelloWorld{ public String hello(String name); } Old anonymous class HelloWorld hello = new HelloWorld() { @Override public String hello(String name) { return "Hello, " + name; } }; Ex 1) -> Get Simplified with Lambda (You don’t need to specify method name) (String name) -> { return “Hello “+name + “!!”; }; Ex 2) Remove String -> JVM best guess – type interface (name) -> { return “Hello “+name+”!!”; }; Ex 3) Remove return – type interface (name) -> { “Hello “+name+”!!”; }; Ex 4) Remove brackets for single implementation. (name) -> “Hello “+name+”!!”; Ex 5) Remove () if parameter is one name -> “Hello “+name+”!!”; (name -> “Hello “+name+”!!”;
  • 10.  Start with .stream(), chain with intermediate operators, end with terminal operator.  IntermediateOperator (filter, map, sorted, distinct, limit)  Terminal Operator (forEach, collect, reduce, iterator)
  • 11.  listOfSomething.stream() .filter( element -> element.age > 30) // .map( ) // not evaluated .sorted() // not evaluated .limit() // not evaluated …. .collect( Collectors.toList() );  Finally evaluate
  • 12. Sample Code (Run com.hidetomo.Java8StreamBench.main) https://github.com/mocchidesu/Java8sample.git Input: 100,000 last name from HSA Do: Filter: Last name start with ‘m’ Map: (Brace each name with [] bracket) Sort: Reverse order Dedupe Limit to top 2 results Loop 1000 times. Traditional Java7 For Loop approach vs. Sequential Lambda vs. Parallel Lambda. -> IntelliJ13
  • 13.  Java 8 is backward compatible in binary level  Lambda is not only a syntax sugar  It’s a new era of Java  Performance gain?Will be improved. Stay tuned.  When use? NOW
  • 14. Everything about Java 8 http://www.techempower.com/blog/2013/03/26/everything-about-java-8/ Oracle Compatibility Guide for JDK 8 http://www.oracle.com/technetwork/java/javase/8-compatibility-guide- 2156366.html Lambda Peek under the Hood by Brian Goetz - Java One 2013 http://www.slideshare.net/jaxlondon2012/lambda-a-peek-under-the-hood-brian- goetz 10 Example of Lambda Expressions and Streams in Java 8 http://javarevisited.blogspot.com/2014/02/10-example-of-lambda-expressions-in- java8.html