SlideShare una empresa de Scribd logo
1 de 22
Descargar para leer sin conexión
12/5/19
Java 8, 9, 10, 11. Delivering New Feature in the
JDK
Ivelin Yanev
INTRODUCTION
12/5/19
Delivery process
2
Old delivery process
12/5/19
Delivery process
3
New delivery process
12/5/19
History
4
12/5/19
Other JDKs
➢
OracleJDK: Free and supported to 6 months
➢
LTS versions have extended ($$$) support by Oracle
➢
Identical to OpenJDK when free
➢
OpenJDK: Free forever, not supported after 6 months
➢
Built by https://adoptopenjdk.net/
➢
Other JVMs (Azul, IBM, RedHat, etc.)
5
12/5/19
Java 9 Features with Examples
1 . Private Methods in Interfaces
Java 7
- Constant variables
- Abstract methods
Java 8
- Constant variables
- Abstract methods
- Default methods
- Static methods
Java 9 Interface Changes
- Constant variables
- Abstract methods
- Default methods
- Static methods
- Private methods
- Private Static methods
Reference: JEP 213
6
12/5/19
Java 9 Features with Examples
2. Collection Factory Methods
- Defines several factory methods (.of(…)) on the List, Set, and Map
interfaces for conveniently creating instances of unmodifiable collections
and maps with small numbers of elements.
- Map.of() is not a varargs method. There are only overloaded Map.of() for up to 10 entries. For a
case where we have more than 10 key-value pairs, there is a different method:
static <K,V> Map<K,V> ofEntries(Map.Entry<? extends K,? extends V>... entries)
Reference: JEP 269
7
12/5/19
Java 9 Features with Examples
3. Try-With-Resources Improvements
Before Java 9
FileInputStream fis = new FileInputStream("movie.mp4");
try (FileInputStream fis2 = fis)
{
//…..
}
catch (IOException e)
{
// ...
}
Reference: JEP 213
8
Java 9+
FileInputStream fis = new FileInputStream("movie.mp4");
try (fis)
{
//…..
}
catch (IOException e)
{
// ...
}
12/5/19
Java 9 Features with Examples
4. Process API Improvements
Two new interfcase in Process API:
java.lang.ProcessHandle
java.lang.ProcessHandle.Info
The ProcessHandle provides:
- The process ID: process.getPid()
- Arguments
- Command
- Start time
- Accumulated CPU time
- User
- Parent process
With the ProcessHandle.onExit method, the asynchronous mechanisms of the CompletableFuture
class can perform an action when the process exits.
Reference: JEP 102
9
12/5/19
Java 9 Features with Examples
5. New Http client API
> The API consists of 3 core classes:
HttpRequest – represents the request to be sent via the HttpClient
HttpClient – behaves as a container for configuration information common to multiple requests
HttpResponse – represents the result of an HttpRequest call
> Send Requests – Sync vs. Async
send(…) – synchronously (blocks until the response comes)
sendAsync(…) – asynchronously (doesn’t wait for response, non-blocking)
Reference: JEP 110
10
12/5/19
Java 9 Features with Examples
6. Optional Class Improvements
●
stream() method:
●
public Stream<T> stream()
●
ifPresentOrElse() method:
●
public void ifPresentOrElse(Consumer<? super T> action, Runnable emptyAction)
●
or() method:
●
public Optional<T> or(Supplier<? extends Optional<? extends T>> supplier)
Reference: JEP-213
11
12/5/19
Java 9 Features with Examples
7. Enhanced @Deprecated annotation
@Deprecated annotation provides better information about the status and intended future of APIs:
➢
forRemoval():
●
This returns a boolean to indicate whether this API element is intended for removal in some future
release.
●
E.g. @Deprecated(forRemoval=true) indicates the API will be removed in the next release of the
Java SE platform.
➢
Since():
●
This returns the release or version number, as a string, when this API element was first marked as
deprecated
@Deprecated(since="9", forRemoval=true)
Reference: JEP 277
12
12/5/19
Java 9 Features with Examples
8. G1 (Default Garbage Collector)
Reference: JEP 248
13
12/5/19
Java 9 Features with Examples
9. StackWalker API
➢
New API for easier manipulation of stack traces
➢
Provided by the java.lang.StackWalker class
Reference: JEP 259
14
12/5/19
Java 9 Features with Examples
10. Compact Strings Improvement
➢
Prior to Java 9, string data was stored as an array of chars. This required 16 bits for each char.
public final class String implements java.io.Serializable, Comparable<String>, CharSequence {
//The value is used for character storage.
private final char value[ ];
}
➢
Starting with Java 9, strings are now internally represented using a byte array along with a flag field for
encoding references.
public final class String implements java.io.Serializable, Comparable<String>, CharSequence {
/** The value is used for character storage. */
private final byte[] value;
private final byte coder;
}
Reference: JEP 280
15
12/5/19
Java 10 Features with Examples
1. JEP 286: Local Variable Type Inference
var list = new ArrayList<String>(); // infers ArrayList<String>
var stream = list.stream(); // infers Stream<String>
2. JEP 307: Parallel Full GC for G1
3. Collection Changes
java.util.List: E> List<E> copyOf(Collection<? extends E> coll)
java.util.Set: <E> Set<E> copyOf(Collection<? extends E> coll)
java.util.Map: <K,V> Map<K,V> copyOf(Map<? extends K, ? extends V> coll)
16
12/5/19
Java 11 Features with Examples
1. JEP 323: Local-Variable Syntax for Lambda Parameters
list.stream()
.map((var s) -> s.toLowerCase())
.collect(Collectors.toList());
list.stream()
.map((@Notnull var s) -> s.toLowerCase())
.collect(Collectors.toList());
2. JEP 330: Launch Single-File Source-Code Programs
java HelloWorld.java
3. JEP 321: HTTP Client (Standard)
➢
HTTP/2 support
➢
Incubating module from JDK 9 standardised
4. JEP 320: Remove The Java EE and CORBA Modules
17
12/5/19
Java 11 Features with Examples
5. New APIs
●
java.io.ByteArrayOutputStream
- void writeBytes(byte[]): Write all the bytes of the parameter to the output stream
●
java.io.FileReader
- Two new constructors that allow a Charset to be specified.
●
java.io.FileWriter
- Four new constructors that allow a Charset to be specified.
●
java.io.InputStream
- io.InputStream nullInputStream()
●
java.io.OutputStream
- io.OutputStream nullOutputStream()
●
java.io.Reader
- io.Reader nullReader()
●
java.io.Writer
- io.Writer nullWriter()
●
java.lang.String
- boolean isBlank(), Stream lines(), String repeat(int), String strip(), String stripLeading(), String
stripTrailing()
18
12/5/19
Java 11 Features with Examples
●
java.lang.Thread:
- destroy() and stop(Throwable) methods have been removed
●
java.nio.file.Files
- String readString(Path): Reads all content from a file into a string, decoding from bytes to characters
using the UTF-8 charset.
- String readString(Path,Charset): As above, except decoding from bytes to characters using the
specified Charset.
- Path writeString(Path, CharSequence, java.nio.file. OpenOption[]:Write a CharSequence to a file.
Characters are encoded into bytes using the UTF-8 charset.
- PathwriteString(Path,CharSequence,java.nio.file.Charset, OpenOption[]: As above, except Characters
are encoded into bytes using the specified Charset.
●
java.nio.file.Path
- Path of(String, String[]): Returns a Path by converting a path string, or a sequence of strings that when
joined form a path string.
- Path of(net.URI): Returns a Path by converting a URI.
●
java.util.Collection
- Object[] toArray(java.util.function.IntFunction): Returns an array containing all of the elements in this
collection, using the provided generator function to allocate the returned array.
●
java.util.function.Predicate
- Predicate not(Predicate)
19
12/5/19
Java 11 Features with Examples
20
6. Removed Features
●
Removal of sun.misc.Unsafe.defineClass: Users should use the public replacement,
java.lang.invoke.MethodHandles.Lookup.defineClass
●
Removal of JavaFX from the Oracle JDK
●
…………
12/5/19
Java 11 Features with Examples
●
7. How much faster is Java 11?
12/5/19
Thank you!

Más contenido relacionado

La actualidad más candente

Java 14 features
Java 14 featuresJava 14 features
Java 14 featuresAditi Anand
 
Java7 - Top 10 Features
Java7 - Top 10 FeaturesJava7 - Top 10 Features
Java7 - Top 10 FeaturesAndreas Enbohm
 
DevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern JavaDevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern JavaHenri Tremblay
 
Java SE 8 - New Features
Java SE 8 - New FeaturesJava SE 8 - New Features
Java SE 8 - New FeaturesNaveen Hegde
 
Core Java Programming Language (JSE) : Chapter X - I/O Fundamentals
Core Java Programming Language (JSE) : Chapter X - I/O Fundamentals Core Java Programming Language (JSE) : Chapter X - I/O Fundamentals
Core Java Programming Language (JSE) : Chapter X - I/O Fundamentals WebStackAcademy
 
Getting the Most From Modern Java
Getting the Most From Modern JavaGetting the Most From Modern Java
Getting the Most From Modern JavaSimon Ritter
 
Porting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQLPorting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQLPeter Eisentraut
 
SQLMAP Tool Usage - A Heads Up
SQLMAP Tool Usage - A  Heads UpSQLMAP Tool Usage - A  Heads Up
SQLMAP Tool Usage - A Heads UpMindfire Solutions
 
Java I/O and Object Serialization
Java I/O and Object SerializationJava I/O and Object Serialization
Java I/O and Object SerializationNavneet Prakash
 
JDK 14 Lots of New Features
JDK 14 Lots of New FeaturesJDK 14 Lots of New Features
JDK 14 Lots of New FeaturesSimon Ritter
 
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)Harmeet Singh(Taara)
 
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 singhHarmeet Singh(Taara)
 

La actualidad más candente (20)

Java 8 features
Java 8 featuresJava 8 features
Java 8 features
 
Java 7 & 8
Java 7 & 8Java 7 & 8
Java 7 & 8
 
Java 14 features
Java 14 featuresJava 14 features
Java 14 features
 
Java7 - Top 10 Features
Java7 - Top 10 FeaturesJava7 - Top 10 Features
Java7 - Top 10 Features
 
DevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern JavaDevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern Java
 
Scala
ScalaScala
Scala
 
Java SE 8 - New Features
Java SE 8 - New FeaturesJava SE 8 - New Features
Java SE 8 - New Features
 
Core Java Programming Language (JSE) : Chapter X - I/O Fundamentals
Core Java Programming Language (JSE) : Chapter X - I/O Fundamentals Core Java Programming Language (JSE) : Chapter X - I/O Fundamentals
Core Java Programming Language (JSE) : Chapter X - I/O Fundamentals
 
Sqlmap
SqlmapSqlmap
Sqlmap
 
Sqlmap
SqlmapSqlmap
Sqlmap
 
Getting the Most From Modern Java
Getting the Most From Modern JavaGetting the Most From Modern Java
Getting the Most From Modern Java
 
Porting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQLPorting Applications From Oracle To PostgreSQL
Porting Applications From Oracle To PostgreSQL
 
SQLMAP Tool Usage - A Heads Up
SQLMAP Tool Usage - A  Heads UpSQLMAP Tool Usage - A  Heads Up
SQLMAP Tool Usage - A Heads Up
 
Java I/O and Object Serialization
Java I/O and Object SerializationJava I/O and Object Serialization
Java I/O and Object Serialization
 
Java Programming - 08 java threading
Java Programming - 08 java threadingJava Programming - 08 java threading
Java Programming - 08 java threading
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
JDK 14 Lots of New Features
JDK 14 Lots of New FeaturesJDK 14 Lots of New Features
JDK 14 Lots of New Features
 
Java8
Java8Java8
Java8
 
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)
 
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
 

Similar a Java features. Java 8, 9, 10, 11

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
 
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...Vadym Kazulkin
 
What to expect from Java 9
What to expect from Java 9What to expect from Java 9
What to expect from Java 9Ivan Krylov
 
New features in Java 7
New features in Java 7New features in Java 7
New features in Java 7Girish Manwani
 
"Highlights from Java 10&11 and Future of Java" at Java User Group Bonn 2018 ...
"Highlights from Java 10&11 and Future of Java" at Java User Group Bonn 2018 ..."Highlights from Java 10&11 and Future of Java" at Java User Group Bonn 2018 ...
"Highlights from Java 10&11 and Future of Java" at Java User Group Bonn 2018 ...Vadym Kazulkin
 
Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Martijn Verburg
 
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
 
Java 9 features
Java 9 featuresJava 9 features
Java 9 featuresshrinath97
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8Martin Toshev
 
What’s expected in Java 9
What’s expected in Java 9What’s expected in Java 9
What’s expected in Java 9Gal Marder
 
Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!Sylvain Wallez
 

Similar a Java features. Java 8, 9, 10, 11 (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
 
Java 7 & 8 New Features
Java 7 & 8 New FeaturesJava 7 & 8 New Features
Java 7 & 8 New Features
 
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
 
Java 8
Java 8Java 8
Java 8
 
What to expect from Java 9
What to expect from Java 9What to expect from Java 9
What to expect from Java 9
 
New features in Java 7
New features in Java 7New features in Java 7
New features in Java 7
 
"Highlights from Java 10&11 and Future of Java" at Java User Group Bonn 2018 ...
"Highlights from Java 10&11 and Future of Java" at Java User Group Bonn 2018 ..."Highlights from Java 10&11 and Future of Java" at Java User Group Bonn 2018 ...
"Highlights from Java 10&11 and Future of Java" at Java User Group Bonn 2018 ...
 
Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)
 
Java 8 Overview
Java 8 OverviewJava 8 Overview
Java 8 Overview
 
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
 
Best Of Jdk 7
Best Of Jdk 7Best Of Jdk 7
Best Of Jdk 7
 
Panama.pdf
Panama.pdfPanama.pdf
Panama.pdf
 
Java 9 features
Java 9 featuresJava 9 features
Java 9 features
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8
 
What’s expected in Java 9
What’s expected in Java 9What’s expected in Java 9
What’s expected in Java 9
 
Java >= 9
Java >= 9Java >= 9
Java >= 9
 
Java
JavaJava
Java
 
Colloquium Report
Colloquium ReportColloquium Report
Colloquium Report
 
Java 7 & 8 - A&BP CC
Java 7 & 8 - A&BP CCJava 7 & 8 - A&BP CC
Java 7 & 8 - A&BP CC
 
Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!Inside the JVM - Follow the white rabbit!
Inside the JVM - Follow the white rabbit!
 

Más de Ivelin Yanev

Quarkus Extensions Turbocharge for Java Microservices.pdf
Quarkus Extensions Turbocharge for Java Microservices.pdfQuarkus Extensions Turbocharge for Java Microservices.pdf
Quarkus Extensions Turbocharge for Java Microservices.pdfIvelin Yanev
 
Empowering Your Java Applications with Quarkus. A New Era of Fast, Efficient,...
Empowering Your Java Applications with Quarkus. A New Era of Fast, Efficient,...Empowering Your Java Applications with Quarkus. A New Era of Fast, Efficient,...
Empowering Your Java Applications with Quarkus. A New Era of Fast, Efficient,...Ivelin Yanev
 
Building flexible ETL pipelines with Apache Camel on Quarkus
Building flexible ETL pipelines with Apache Camel on QuarkusBuilding flexible ETL pipelines with Apache Camel on Quarkus
Building flexible ETL pipelines with Apache Camel on QuarkusIvelin Yanev
 
Introducing java oop concepts
Introducing java oop conceptsIntroducing java oop concepts
Introducing java oop conceptsIvelin Yanev
 
Introducing generic types
Introducing generic typesIntroducing generic types
Introducing generic typesIvelin Yanev
 
Java 9 modularity+
Java 9 modularity+Java 9 modularity+
Java 9 modularity+Ivelin Yanev
 
Intoduction Internet of Things
Intoduction Internet of ThingsIntoduction Internet of Things
Intoduction Internet of ThingsIvelin Yanev
 

Más de Ivelin Yanev (11)

Quarkus Extensions Turbocharge for Java Microservices.pdf
Quarkus Extensions Turbocharge for Java Microservices.pdfQuarkus Extensions Turbocharge for Java Microservices.pdf
Quarkus Extensions Turbocharge for Java Microservices.pdf
 
Empowering Your Java Applications with Quarkus. A New Era of Fast, Efficient,...
Empowering Your Java Applications with Quarkus. A New Era of Fast, Efficient,...Empowering Your Java Applications with Quarkus. A New Era of Fast, Efficient,...
Empowering Your Java Applications with Quarkus. A New Era of Fast, Efficient,...
 
Project Loom
Project LoomProject Loom
Project Loom
 
Building flexible ETL pipelines with Apache Camel on Quarkus
Building flexible ETL pipelines with Apache Camel on QuarkusBuilding flexible ETL pipelines with Apache Camel on Quarkus
Building flexible ETL pipelines with Apache Camel on Quarkus
 
Git collaboration
Git collaborationGit collaboration
Git collaboration
 
Java exeptions
Java exeptionsJava exeptions
Java exeptions
 
Introducing java oop concepts
Introducing java oop conceptsIntroducing java oop concepts
Introducing java oop concepts
 
Introducing generic types
Introducing generic typesIntroducing generic types
Introducing generic types
 
Design principles
Design principlesDesign principles
Design principles
 
Java 9 modularity+
Java 9 modularity+Java 9 modularity+
Java 9 modularity+
 
Intoduction Internet of Things
Intoduction Internet of ThingsIntoduction Internet of Things
Intoduction Internet of Things
 

Último

W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 

Último (20)

W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 

Java features. Java 8, 9, 10, 11

  • 1. 12/5/19 Java 8, 9, 10, 11. Delivering New Feature in the JDK Ivelin Yanev INTRODUCTION
  • 5. 12/5/19 Other JDKs ➢ OracleJDK: Free and supported to 6 months ➢ LTS versions have extended ($$$) support by Oracle ➢ Identical to OpenJDK when free ➢ OpenJDK: Free forever, not supported after 6 months ➢ Built by https://adoptopenjdk.net/ ➢ Other JVMs (Azul, IBM, RedHat, etc.) 5
  • 6. 12/5/19 Java 9 Features with Examples 1 . Private Methods in Interfaces Java 7 - Constant variables - Abstract methods Java 8 - Constant variables - Abstract methods - Default methods - Static methods Java 9 Interface Changes - Constant variables - Abstract methods - Default methods - Static methods - Private methods - Private Static methods Reference: JEP 213 6
  • 7. 12/5/19 Java 9 Features with Examples 2. Collection Factory Methods - Defines several factory methods (.of(…)) on the List, Set, and Map interfaces for conveniently creating instances of unmodifiable collections and maps with small numbers of elements. - Map.of() is not a varargs method. There are only overloaded Map.of() for up to 10 entries. For a case where we have more than 10 key-value pairs, there is a different method: static <K,V> Map<K,V> ofEntries(Map.Entry<? extends K,? extends V>... entries) Reference: JEP 269 7
  • 8. 12/5/19 Java 9 Features with Examples 3. Try-With-Resources Improvements Before Java 9 FileInputStream fis = new FileInputStream("movie.mp4"); try (FileInputStream fis2 = fis) { //….. } catch (IOException e) { // ... } Reference: JEP 213 8 Java 9+ FileInputStream fis = new FileInputStream("movie.mp4"); try (fis) { //….. } catch (IOException e) { // ... }
  • 9. 12/5/19 Java 9 Features with Examples 4. Process API Improvements Two new interfcase in Process API: java.lang.ProcessHandle java.lang.ProcessHandle.Info The ProcessHandle provides: - The process ID: process.getPid() - Arguments - Command - Start time - Accumulated CPU time - User - Parent process With the ProcessHandle.onExit method, the asynchronous mechanisms of the CompletableFuture class can perform an action when the process exits. Reference: JEP 102 9
  • 10. 12/5/19 Java 9 Features with Examples 5. New Http client API > The API consists of 3 core classes: HttpRequest – represents the request to be sent via the HttpClient HttpClient – behaves as a container for configuration information common to multiple requests HttpResponse – represents the result of an HttpRequest call > Send Requests – Sync vs. Async send(…) – synchronously (blocks until the response comes) sendAsync(…) – asynchronously (doesn’t wait for response, non-blocking) Reference: JEP 110 10
  • 11. 12/5/19 Java 9 Features with Examples 6. Optional Class Improvements ● stream() method: ● public Stream<T> stream() ● ifPresentOrElse() method: ● public void ifPresentOrElse(Consumer<? super T> action, Runnable emptyAction) ● or() method: ● public Optional<T> or(Supplier<? extends Optional<? extends T>> supplier) Reference: JEP-213 11
  • 12. 12/5/19 Java 9 Features with Examples 7. Enhanced @Deprecated annotation @Deprecated annotation provides better information about the status and intended future of APIs: ➢ forRemoval(): ● This returns a boolean to indicate whether this API element is intended for removal in some future release. ● E.g. @Deprecated(forRemoval=true) indicates the API will be removed in the next release of the Java SE platform. ➢ Since(): ● This returns the release or version number, as a string, when this API element was first marked as deprecated @Deprecated(since="9", forRemoval=true) Reference: JEP 277 12
  • 13. 12/5/19 Java 9 Features with Examples 8. G1 (Default Garbage Collector) Reference: JEP 248 13
  • 14. 12/5/19 Java 9 Features with Examples 9. StackWalker API ➢ New API for easier manipulation of stack traces ➢ Provided by the java.lang.StackWalker class Reference: JEP 259 14
  • 15. 12/5/19 Java 9 Features with Examples 10. Compact Strings Improvement ➢ Prior to Java 9, string data was stored as an array of chars. This required 16 bits for each char. public final class String implements java.io.Serializable, Comparable<String>, CharSequence { //The value is used for character storage. private final char value[ ]; } ➢ Starting with Java 9, strings are now internally represented using a byte array along with a flag field for encoding references. public final class String implements java.io.Serializable, Comparable<String>, CharSequence { /** The value is used for character storage. */ private final byte[] value; private final byte coder; } Reference: JEP 280 15
  • 16. 12/5/19 Java 10 Features with Examples 1. JEP 286: Local Variable Type Inference var list = new ArrayList<String>(); // infers ArrayList<String> var stream = list.stream(); // infers Stream<String> 2. JEP 307: Parallel Full GC for G1 3. Collection Changes java.util.List: E> List<E> copyOf(Collection<? extends E> coll) java.util.Set: <E> Set<E> copyOf(Collection<? extends E> coll) java.util.Map: <K,V> Map<K,V> copyOf(Map<? extends K, ? extends V> coll) 16
  • 17. 12/5/19 Java 11 Features with Examples 1. JEP 323: Local-Variable Syntax for Lambda Parameters list.stream() .map((var s) -> s.toLowerCase()) .collect(Collectors.toList()); list.stream() .map((@Notnull var s) -> s.toLowerCase()) .collect(Collectors.toList()); 2. JEP 330: Launch Single-File Source-Code Programs java HelloWorld.java 3. JEP 321: HTTP Client (Standard) ➢ HTTP/2 support ➢ Incubating module from JDK 9 standardised 4. JEP 320: Remove The Java EE and CORBA Modules 17
  • 18. 12/5/19 Java 11 Features with Examples 5. New APIs ● java.io.ByteArrayOutputStream - void writeBytes(byte[]): Write all the bytes of the parameter to the output stream ● java.io.FileReader - Two new constructors that allow a Charset to be specified. ● java.io.FileWriter - Four new constructors that allow a Charset to be specified. ● java.io.InputStream - io.InputStream nullInputStream() ● java.io.OutputStream - io.OutputStream nullOutputStream() ● java.io.Reader - io.Reader nullReader() ● java.io.Writer - io.Writer nullWriter() ● java.lang.String - boolean isBlank(), Stream lines(), String repeat(int), String strip(), String stripLeading(), String stripTrailing() 18
  • 19. 12/5/19 Java 11 Features with Examples ● java.lang.Thread: - destroy() and stop(Throwable) methods have been removed ● java.nio.file.Files - String readString(Path): Reads all content from a file into a string, decoding from bytes to characters using the UTF-8 charset. - String readString(Path,Charset): As above, except decoding from bytes to characters using the specified Charset. - Path writeString(Path, CharSequence, java.nio.file. OpenOption[]:Write a CharSequence to a file. Characters are encoded into bytes using the UTF-8 charset. - PathwriteString(Path,CharSequence,java.nio.file.Charset, OpenOption[]: As above, except Characters are encoded into bytes using the specified Charset. ● java.nio.file.Path - Path of(String, String[]): Returns a Path by converting a path string, or a sequence of strings that when joined form a path string. - Path of(net.URI): Returns a Path by converting a URI. ● java.util.Collection - Object[] toArray(java.util.function.IntFunction): Returns an array containing all of the elements in this collection, using the provided generator function to allocate the returned array. ● java.util.function.Predicate - Predicate not(Predicate) 19
  • 20. 12/5/19 Java 11 Features with Examples 20 6. Removed Features ● Removal of sun.misc.Unsafe.defineClass: Users should use the public replacement, java.lang.invoke.MethodHandles.Lookup.defineClass ● Removal of JavaFX from the Oracle JDK ● …………
  • 21. 12/5/19 Java 11 Features with Examples ● 7. How much faster is Java 11?