SlideShare a Scribd company logo
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!

More Related Content

What's hot (20)

PDF
Java 8 features
NexThoughts Technologies
 
PPTX
Java 7 & 8
Ken Coenen
 
PPTX
Java 14 features
Aditi Anand
 
PPTX
Java7 - Top 10 Features
Andreas Enbohm
 
PPTX
DevNexus 2020: Discover Modern Java
Henri Tremblay
 
PPT
Scala
Andreas Enbohm
 
PPTX
Java SE 8 - New Features
Naveen Hegde
 
PDF
Core Java Programming Language (JSE) : Chapter X - I/O Fundamentals
WebStackAcademy
 
PPTX
Sqlmap
Rushikesh Kulkarni
 
PPTX
Sqlmap
shamshad9
 
PPTX
Getting the Most From Modern Java
Simon Ritter
 
ODP
Porting Applications From Oracle To PostgreSQL
Peter Eisentraut
 
PPT
SQLMAP Tool Usage - A Heads Up
Mindfire Solutions
 
PPTX
Java I/O and Object Serialization
Navneet Prakash
 
PDF
Java Programming - 08 java threading
Danairat Thanabodithammachari
 
PPTX
Functional programming
Lhouceine OUHAMZA
 
PPTX
JDK 14 Lots of New Features
Simon Ritter
 
PDF
Java8
Felipe Mamud
 
PPTX
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Harmeet Singh(Taara)
 
PDF
Functional programming in java 8 by harmeet singh
Harmeet Singh(Taara)
 
Java 8 features
NexThoughts Technologies
 
Java 7 & 8
Ken Coenen
 
Java 14 features
Aditi Anand
 
Java7 - Top 10 Features
Andreas Enbohm
 
DevNexus 2020: Discover Modern Java
Henri Tremblay
 
Java SE 8 - New Features
Naveen Hegde
 
Core Java Programming Language (JSE) : Chapter X - I/O Fundamentals
WebStackAcademy
 
Sqlmap
shamshad9
 
Getting the Most From Modern Java
Simon Ritter
 
Porting Applications From Oracle To PostgreSQL
Peter Eisentraut
 
SQLMAP Tool Usage - A Heads Up
Mindfire Solutions
 
Java I/O and Object Serialization
Navneet Prakash
 
Java Programming - 08 java threading
Danairat Thanabodithammachari
 
Functional programming
Lhouceine OUHAMZA
 
JDK 14 Lots of New Features
Simon Ritter
 
Java 8 Streams And Common Operations By Harmeet Singh(Taara)
Harmeet Singh(Taara)
 
Functional programming in java 8 by harmeet singh
Harmeet Singh(Taara)
 

Similar to Java features. Java 8, 9, 10, 11 (20)

PDF
FFM / Panama: A case study with OpenSSL and Tomcat
Jean-Frederic Clere
 
PPTX
Introduction of Java 8 with emphasis on Lambda Expressions and Streams
Emiel Paasschens
 
PPTX
Java 7 & 8 New Features
Leandro Coutinho
 
PDF
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Vadym Kazulkin
 
PPTX
Java 8
Sudipta K Paik
 
PDF
What to expect from Java 9
Ivan Krylov
 
PPTX
New features in Java 7
Girish Manwani
 
PDF
"Highlights from Java 10&11 and Future of Java" at Java User Group Bonn 2018 ...
Vadym Kazulkin
 
KEY
Back to the future with Java 7 (Geekout June/2011)
Martijn Verburg
 
PDF
Java 8 Overview
Nicola Pedot
 
PPTX
Java 7 Whats New(), Whats Next() from Oredev
Mattias Karlsson
 
ODT
Best Of Jdk 7
Kaniska Mandal
 
PDF
Panama.pdf
Jean-Frederic Clere
 
PPTX
Java 9 features
shrinath97
 
PPTX
New Features in JDK 8
Martin Toshev
 
PPTX
What’s expected in Java 9
Gal Marder
 
PDF
Java >= 9
Benjamin Pack
 
PPTX
Java
박 경민
 
DOCX
Colloquium Report
Mohammad Faizan
 
PPTX
Java 7 & 8 - A&BP CC
JWORKS powered by Ordina
 
FFM / Panama: A case study with OpenSSL and Tomcat
Jean-Frederic Clere
 
Introduction of Java 8 with emphasis on Lambda Expressions and Streams
Emiel Paasschens
 
Java 7 & 8 New Features
Leandro Coutinho
 
Highlights from Java 10, 11 and 12 and Future of Java at Javaland 2019 By Vad...
Vadym Kazulkin
 
What to expect from Java 9
Ivan Krylov
 
New features in Java 7
Girish Manwani
 
"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)
Martijn Verburg
 
Java 8 Overview
Nicola Pedot
 
Java 7 Whats New(), Whats Next() from Oredev
Mattias Karlsson
 
Best Of Jdk 7
Kaniska Mandal
 
Java 9 features
shrinath97
 
New Features in JDK 8
Martin Toshev
 
What’s expected in Java 9
Gal Marder
 
Java >= 9
Benjamin Pack
 
Colloquium Report
Mohammad Faizan
 
Java 7 & 8 - A&BP CC
JWORKS powered by Ordina
 
Ad

More from Ivelin Yanev (11)

PDF
Quarkus Extensions Turbocharge for Java Microservices.pdf
Ivelin Yanev
 
PDF
Empowering Your Java Applications with Quarkus. A New Era of Fast, Efficient,...
Ivelin Yanev
 
PDF
Project Loom
Ivelin Yanev
 
PPTX
Building flexible ETL pipelines with Apache Camel on Quarkus
Ivelin Yanev
 
PDF
Git collaboration
Ivelin Yanev
 
PDF
Java exeptions
Ivelin Yanev
 
PDF
Introducing java oop concepts
Ivelin Yanev
 
PDF
Introducing generic types
Ivelin Yanev
 
PDF
Design principles
Ivelin Yanev
 
PDF
Java 9 modularity+
Ivelin Yanev
 
PDF
Intoduction Internet of Things
Ivelin Yanev
 
Quarkus Extensions Turbocharge for Java Microservices.pdf
Ivelin Yanev
 
Empowering Your Java Applications with Quarkus. A New Era of Fast, Efficient,...
Ivelin Yanev
 
Project Loom
Ivelin Yanev
 
Building flexible ETL pipelines with Apache Camel on Quarkus
Ivelin Yanev
 
Git collaboration
Ivelin Yanev
 
Java exeptions
Ivelin Yanev
 
Introducing java oop concepts
Ivelin Yanev
 
Introducing generic types
Ivelin Yanev
 
Design principles
Ivelin Yanev
 
Java 9 modularity+
Ivelin Yanev
 
Intoduction Internet of Things
Ivelin Yanev
 
Ad

Recently uploaded (20)

PPTX
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
PPTX
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
PPTX
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
PDF
GridView,Recycler view, API, SQLITE& NetworkRequest.pdf
Nabin Dhakal
 
PDF
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
PPTX
How Odoo Became a Game-Changer for an IT Company in Manufacturing ERP
SatishKumar2651
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PPTX
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
Executive Business Intelligence Dashboards
vandeslie24
 
PPTX
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
PDF
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
PDF
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
PDF
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
PPTX
Perfecting XM Cloud for Multisite Setup.pptx
Ahmed Okour
 
PPTX
MiniTool Power Data Recovery Full Crack Latest 2025
muhammadgurbazkhan
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PDF
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
GridView,Recycler view, API, SQLITE& NetworkRequest.pdf
Nabin Dhakal
 
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
How Odoo Became a Game-Changer for an IT Company in Manufacturing ERP
SatishKumar2651
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Executive Business Intelligence Dashboards
vandeslie24
 
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
Streamline Contractor Lifecycle- TECH EHS Solution
TECH EHS Solution
 
Perfecting XM Cloud for Multisite Setup.pptx
Ahmed Okour
 
MiniTool Power Data Recovery Full Crack Latest 2025
muhammadgurbazkhan
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 

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?