SlideShare ist ein Scribd-Unternehmen logo
1 von 40
WHAT’S NEW IN JAVA 8
ABOUT ME Rajmahendra Hegde (Raj)
• Working for ValueLabs as Scrum Master/Project
Lead
• 14 years Java development
• JUG Hyderabad Lead
• NetBeans Dream Team Member
• JCP Individual and Expert Group Member for 3
JSRs
• Comitter / Contributor: JBake, Forge, NetBeans,
eWidgetFX, JavaFX, Gradle, Agorava, JRebirth,
ScalaFX
Twitter: @rajonjava
GitHub: rajmahendra
LinkedIn: rajmahendra
AGENDA
 Lambda
 Streams
 Date & Time
 Nashorn
 Java FX
JAVA LAMBDA !
Java with functional style.
JAVA LAMBDA
 Beginning of Functional flavor into Java platform
 Lambda provides anonymous function to Java
 Replaces the old use of Anonymous inner classes
 Write more compact code
 Parallel programming easier
ANONYMOUS INNER CLASS
LAMBDAFIDE ANONYMOUS INNER CLASS
LAMBDA EXPRESSION
 ( ) ->
 ( ) -> { }
 a -> a
 x -> { int y=4; return x * y; }
LAMBDA & FUNCTIONAL INTERFACE
 Functional interface are interface with only one
method.
 Java space is filled of such Interfaces
 java.lang.Runnable.run();
 java.util.Comparator.compare(T a, Tb);
 java.awt.event.ActionListener.actionPerformed(
ActionEvent e)
JAVA8 LAMBDA PACKAGE
 Additionally Java8 also provides
FunctionalInterface in package java.util.function to
use with Lambdas. This package contains more
than 40 commonly used FI
 Predicate<T>.test(T t) - Represents a predicate
(boolean-valued function) of one argument
 Consumer<T>.accept(T t) - Represents an operation
that accepts a single input argument and returns no
result
 Function<T, R>.R accept(T t) - Represents a function
that accepts one argument and produces a result
 Supplier<T>. T get() -Represents a supplier of results
 …
@FUNCTIONALINTERFACE
 FunctionalInterface = Interface with only one
method
 Annotation is optional. Its only to make sure the
interface is a FunctionalInterface
 Any interface with only one method can be
considered as FunctionalInterface
LAMBDA TO LOCAL VARIABLE
VARIABLE CAPTURE
 Lambda can interact with the variable outside of its
body
 Using the variables outside of the Lambda
expression is called Variable Capture
 Effectively final
LAMBDA VS ANONYMOUS INNER CLASS
 Lambda != Anonymous Inner Class
 Inner class can have state
 Inner class can have multiple methods
 this points to the object instance in a inner class
but points to the enclosed object in Lambda
 Lambda != Anonymous Inner Class
METHOD REFERENCE
 Use method reference when you use Lambda
expression
 Reduces boilerplate code
 NOTE: return type of lambda expression must
match with the signature of the referred method
METHOD REFERENCE TYPES
 Static Method
 Printer::print
 Instance Method
 myObject::print
 Constructor
 Page::new
DEFAULT METHOD - INTERFACE
 Provides a way to add new methods to interface
without breaking the old implementation
 default keyword is introduced to do this magic
NO MORE NULLPOINTEREXCEPTION !
 Wrapper class to guard from Null Exception
 java.util.Optional<T>
 It contain a data or a empty
STREAMS
STREAMS
 Streams are functional programming design pattern
 Helps in processing sequential elements as
sequentially or parallel
 In java we use in many different places
 Retrieve database query as list objects
 Iterate over xml or json elements
 Read multiple lines
 Collections, map etc.
STREAMS IN JAVA
 To create a stream you use a Source collection
 Add a filter option to the stream Intermediate
operation pipeline
 And ends with Terminal operation which starts the
stream process
STREAM LIFECYCLE
 Creation – Stream is created with the collection
object from source
 Configure – get configured with the list of pipeline
operators
 Execution – Streams Terminal operation triggers
the stream to starts by pulling objects into the
pipeline
 Cleanup
DATE & TIME API
OLD DATE/TIME API
 java.util.Date
 java.sql.Date
 java.util.Calendar
 java.util.GregorianCalendar
 java.util.TimeZone
 java.text.DateFormat
 java.text.SimpleDateFormat
ISSUES WITH OLD API
 All are just utility class (in java.util package or in
java.text)
 Date class contains both Date and Time
 Different Date class for SQL!
 Date doesn't have timezone
 Month is zero based, year is 1900 based.
 Not thread safe by default
 Arithmetic operations are hard to use
DATE AND TIME API
 New dedicated date time package java.time
 Dedicated class for Date and time LocalDate and
LocalTime
 A composite class for both LocalDateTime
 Numerous way to create Date time objects
 Support for Truncation, TimeZones, Periods,
Durations and Chronologies
 More fluent, clean and simple API
 Immutable classes
LOCALDATE
 Year-Month-Day
 Only for Date manipulation
 Stores or create one particular Date
LOCALTIME
 Hours-Minutes-Seconds-nano
LOCALDATETIME
 Combination of LocalDate & LocalTime
 All methods of both class available
TIMEZONE
 Numerous timezones are available
 Some time complex to manipulate
 Some time it may change frequently
 TimeZone Classes
 ZoneId – Europe/London etc.
 ZoneOffset – offset from UTC time
 ZoneRules – defines timezone rules
 ZonedDateTime – TimeZone aware Datetime class
DURATION
 Time based amount of time
PERIOD
 Date based amount of time
NASHORN
NASHORN
 Nashorn is a JavaScript Engine developed on Java
 Light-weight, high-performance integrated into JRE
 ECMAScript-262 Edition 5.1 language specification
compliance
 Java 8 shipped with a command-line tool called jjs
 JDK 6 already shipped with Mozilla’s Rhino
JavaScript Engine.
CALLING JAVASCRIPT FROM JAVA
CALLING JAVA FROM JAVASCRIPT
JAVAFX
• http://www.slideshare.net/rajmahendra/javafx-2-rich-
desktop-platform
• http://www.slideshare.net/Codemotion/codemotion-
whatsnewforjavafxinjdk8
JAVA 9!
 September 22nd 2016
 Timeline
 2015-12-10 Feature Complete
 2016-02-04 All Tests Run
 2016-02-25 Ramp down Start
 2016-04-21 Zero Bug Bounce
 2016-06-16 Ramp down Phase 2
 2016-07-21 Final Release Candidate
 2016-09-22 General Availability
 Project Jigsaw
 REPL
 …
Q & A
Rajmahendra Hegde
http://meetup.com/jughyderabad
Twitter: @rajonjava GitHub: rajmahendra
LinkedIn: rajmahendra SllideShare: rajmahendra
Rajmahendra Hegde
http://meetup.com/jughyderabad
Twitter: @rajonjava GitHub: rajmahendra LinkedIn: rajmahendra SllideShare: rajmahendra

Weitere ähnliche Inhalte

Was ist angesagt?

Functional programming in scala
Functional programming in scalaFunctional programming in scala
Functional programming in scala
Stratio
 
introduction to javascript
introduction to javascriptintroduction to javascript
introduction to javascript
Kumar
 

Was ist angesagt? (20)

Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Lecture1
Lecture1Lecture1
Lecture1
 
A Scala tutorial
A Scala tutorialA Scala tutorial
A Scala tutorial
 
Drilling the Async Library
Drilling the Async LibraryDrilling the Async Library
Drilling the Async Library
 
Functional programming in scala
Functional programming in scalaFunctional programming in scala
Functional programming in scala
 
Java 8 Bootcamp
Java 8 BootcampJava 8 Bootcamp
Java 8 Bootcamp
 
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
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
 
What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!
What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!
What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
JS - Basics
JS - BasicsJS - Basics
JS - Basics
 
Python Lambda Function
Python Lambda FunctionPython Lambda Function
Python Lambda Function
 
Functional programming with Java 8
Functional programming with Java 8Functional programming with Java 8
Functional programming with Java 8
 
Scala : language of the future
Scala : language of the futureScala : language of the future
Scala : language of the future
 
From Ruby to Scala
From Ruby to ScalaFrom Ruby to Scala
From Ruby to Scala
 
20160520 what youneedtoknowaboutlambdas
20160520 what youneedtoknowaboutlambdas20160520 what youneedtoknowaboutlambdas
20160520 what youneedtoknowaboutlambdas
 
New Features of JAVA SE8
New Features of JAVA SE8New Features of JAVA SE8
New Features of JAVA SE8
 
I18nize Scala programs à la gettext
I18nize Scala programs à la gettextI18nize Scala programs à la gettext
I18nize Scala programs à la gettext
 
Refactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 RecapRefactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 Recap
 
introduction to javascript
introduction to javascriptintroduction to javascript
introduction to javascript
 

Andere mochten auch

Andere mochten auch (10)

JSR 354 - Money and Currency API
JSR 354 - Money and Currency APIJSR 354 - Money and Currency API
JSR 354 - Money and Currency API
 
JUGChennai UserGroup BestPractices
JUGChennai UserGroup BestPracticesJUGChennai UserGroup BestPractices
JUGChennai UserGroup BestPractices
 
JavaFX 2 Rich Desktop Platform
JavaFX 2 Rich Desktop PlatformJavaFX 2 Rich Desktop Platform
JavaFX 2 Rich Desktop Platform
 
Inside jcp
Inside jcpInside jcp
Inside jcp
 
About JUGChennai 2011
About JUGChennai 2011About JUGChennai 2011
About JUGChennai 2011
 
JUGHyderabad - APOUC '15 - 4 minutes pitch
JUGHyderabad - APOUC '15 - 4 minutes pitchJUGHyderabad - APOUC '15 - 4 minutes pitch
JUGHyderabad - APOUC '15 - 4 minutes pitch
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
 
Javafx
JavafxJavafx
Javafx
 
Hyderabad Scala Community first meetup
Hyderabad Scala Community first meetupHyderabad Scala Community first meetup
Hyderabad Scala Community first meetup
 
JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016
 

Ähnlich wie What’s new in java 8

A-Brief-Introduction-To-JAVA8_By_Srimanta_Sahu
A-Brief-Introduction-To-JAVA8_By_Srimanta_SahuA-Brief-Introduction-To-JAVA8_By_Srimanta_Sahu
A-Brief-Introduction-To-JAVA8_By_Srimanta_Sahu
Srimanta Sahu
 

Ähnlich wie What’s new in java 8 (20)

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
 
Java8 features
Java8 featuresJava8 features
Java8 features
 
Java features
Java featuresJava features
Java features
 
Java 8 lambdas expressions
Java 8 lambdas expressionsJava 8 lambdas expressions
Java 8 lambdas expressions
 
Functional Programming In Jdk8
Functional Programming In Jdk8 Functional Programming In Jdk8
Functional Programming In Jdk8
 
Lambda Expressions Java 8 Features usage
Lambda Expressions  Java 8 Features usageLambda Expressions  Java 8 Features usage
Lambda Expressions Java 8 Features usage
 
Lambdas in Java 8
Lambdas in Java 8Lambdas in Java 8
Lambdas in Java 8
 
Java SE 8 & EE 7 Launch
Java SE 8 & EE 7 LaunchJava SE 8 & EE 7 Launch
Java SE 8 & EE 7 Launch
 
2014 10 java 8 major new language features
2014 10 java 8 major new language features2014 10 java 8 major new language features
2014 10 java 8 major new language features
 
Typescript in 30mins
Typescript in 30mins Typescript in 30mins
Typescript in 30mins
 
Insight into java 1.8, OOP VS FP
Insight into java 1.8, OOP VS FPInsight into java 1.8, OOP VS FP
Insight into java 1.8, OOP VS FP
 
Java 8
Java 8Java 8
Java 8
 
A Tour Of Scala
A Tour Of ScalaA Tour Of Scala
A Tour Of Scala
 
Scala tutorial
Scala tutorialScala tutorial
Scala tutorial
 
Scala tutorial
Scala tutorialScala tutorial
Scala tutorial
 
Java se 8 fundamentals
Java se 8 fundamentalsJava se 8 fundamentals
Java se 8 fundamentals
 
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
 
A-Brief-Introduction-To-JAVA8_By_Srimanta_Sahu
A-Brief-Introduction-To-JAVA8_By_Srimanta_SahuA-Brief-Introduction-To-JAVA8_By_Srimanta_Sahu
A-Brief-Introduction-To-JAVA8_By_Srimanta_Sahu
 
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 - Features Overview
Java 8 - Features OverviewJava 8 - Features Overview
Java 8 - Features Overview
 

Kürzlich hochgeladen

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
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 ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
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
 

What’s new in java 8

  • 2. ABOUT ME Rajmahendra Hegde (Raj) • Working for ValueLabs as Scrum Master/Project Lead • 14 years Java development • JUG Hyderabad Lead • NetBeans Dream Team Member • JCP Individual and Expert Group Member for 3 JSRs • Comitter / Contributor: JBake, Forge, NetBeans, eWidgetFX, JavaFX, Gradle, Agorava, JRebirth, ScalaFX Twitter: @rajonjava GitHub: rajmahendra LinkedIn: rajmahendra
  • 3. AGENDA  Lambda  Streams  Date & Time  Nashorn  Java FX
  • 4. JAVA LAMBDA ! Java with functional style.
  • 5. JAVA LAMBDA  Beginning of Functional flavor into Java platform  Lambda provides anonymous function to Java  Replaces the old use of Anonymous inner classes  Write more compact code  Parallel programming easier
  • 8. LAMBDA EXPRESSION  ( ) ->  ( ) -> { }  a -> a  x -> { int y=4; return x * y; }
  • 9. LAMBDA & FUNCTIONAL INTERFACE  Functional interface are interface with only one method.  Java space is filled of such Interfaces  java.lang.Runnable.run();  java.util.Comparator.compare(T a, Tb);  java.awt.event.ActionListener.actionPerformed( ActionEvent e)
  • 10. JAVA8 LAMBDA PACKAGE  Additionally Java8 also provides FunctionalInterface in package java.util.function to use with Lambdas. This package contains more than 40 commonly used FI  Predicate<T>.test(T t) - Represents a predicate (boolean-valued function) of one argument  Consumer<T>.accept(T t) - Represents an operation that accepts a single input argument and returns no result  Function<T, R>.R accept(T t) - Represents a function that accepts one argument and produces a result  Supplier<T>. T get() -Represents a supplier of results  …
  • 11. @FUNCTIONALINTERFACE  FunctionalInterface = Interface with only one method  Annotation is optional. Its only to make sure the interface is a FunctionalInterface  Any interface with only one method can be considered as FunctionalInterface
  • 12. LAMBDA TO LOCAL VARIABLE
  • 13. VARIABLE CAPTURE  Lambda can interact with the variable outside of its body  Using the variables outside of the Lambda expression is called Variable Capture  Effectively final
  • 14. LAMBDA VS ANONYMOUS INNER CLASS  Lambda != Anonymous Inner Class  Inner class can have state  Inner class can have multiple methods  this points to the object instance in a inner class but points to the enclosed object in Lambda  Lambda != Anonymous Inner Class
  • 15. METHOD REFERENCE  Use method reference when you use Lambda expression  Reduces boilerplate code  NOTE: return type of lambda expression must match with the signature of the referred method
  • 16. METHOD REFERENCE TYPES  Static Method  Printer::print  Instance Method  myObject::print  Constructor  Page::new
  • 17. DEFAULT METHOD - INTERFACE  Provides a way to add new methods to interface without breaking the old implementation  default keyword is introduced to do this magic
  • 18. NO MORE NULLPOINTEREXCEPTION !  Wrapper class to guard from Null Exception  java.util.Optional<T>  It contain a data or a empty
  • 20. STREAMS  Streams are functional programming design pattern  Helps in processing sequential elements as sequentially or parallel  In java we use in many different places  Retrieve database query as list objects  Iterate over xml or json elements  Read multiple lines  Collections, map etc.
  • 21. STREAMS IN JAVA  To create a stream you use a Source collection  Add a filter option to the stream Intermediate operation pipeline  And ends with Terminal operation which starts the stream process
  • 22. STREAM LIFECYCLE  Creation – Stream is created with the collection object from source  Configure – get configured with the list of pipeline operators  Execution – Streams Terminal operation triggers the stream to starts by pulling objects into the pipeline  Cleanup
  • 23. DATE & TIME API
  • 24. OLD DATE/TIME API  java.util.Date  java.sql.Date  java.util.Calendar  java.util.GregorianCalendar  java.util.TimeZone  java.text.DateFormat  java.text.SimpleDateFormat
  • 25. ISSUES WITH OLD API  All are just utility class (in java.util package or in java.text)  Date class contains both Date and Time  Different Date class for SQL!  Date doesn't have timezone  Month is zero based, year is 1900 based.  Not thread safe by default  Arithmetic operations are hard to use
  • 26. DATE AND TIME API  New dedicated date time package java.time  Dedicated class for Date and time LocalDate and LocalTime  A composite class for both LocalDateTime  Numerous way to create Date time objects  Support for Truncation, TimeZones, Periods, Durations and Chronologies  More fluent, clean and simple API  Immutable classes
  • 27. LOCALDATE  Year-Month-Day  Only for Date manipulation  Stores or create one particular Date
  • 29. LOCALDATETIME  Combination of LocalDate & LocalTime  All methods of both class available
  • 30. TIMEZONE  Numerous timezones are available  Some time complex to manipulate  Some time it may change frequently  TimeZone Classes  ZoneId – Europe/London etc.  ZoneOffset – offset from UTC time  ZoneRules – defines timezone rules  ZonedDateTime – TimeZone aware Datetime class
  • 31. DURATION  Time based amount of time
  • 32. PERIOD  Date based amount of time
  • 34. NASHORN  Nashorn is a JavaScript Engine developed on Java  Light-weight, high-performance integrated into JRE  ECMAScript-262 Edition 5.1 language specification compliance  Java 8 shipped with a command-line tool called jjs  JDK 6 already shipped with Mozilla’s Rhino JavaScript Engine.
  • 36. CALLING JAVA FROM JAVASCRIPT
  • 38. JAVA 9!  September 22nd 2016  Timeline  2015-12-10 Feature Complete  2016-02-04 All Tests Run  2016-02-25 Ramp down Start  2016-04-21 Zero Bug Bounce  2016-06-16 Ramp down Phase 2  2016-07-21 Final Release Candidate  2016-09-22 General Availability  Project Jigsaw  REPL  …
  • 39. Q & A Rajmahendra Hegde http://meetup.com/jughyderabad Twitter: @rajonjava GitHub: rajmahendra LinkedIn: rajmahendra SllideShare: rajmahendra
  • 40. Rajmahendra Hegde http://meetup.com/jughyderabad Twitter: @rajonjava GitHub: rajmahendra LinkedIn: rajmahendra SllideShare: rajmahendra