Home  >  Java 11

Java 11 New Features

By Arvind Rai, October 22, 2020
On this page we will provide Java 11 new features. In Java 11 the deployment stack, required for Applets and Web Start Applications has been removed. Auto-update for JRE installations on Windows and macOS, is no longer available. In this release, the JRE or Server JRE is no longer offered. Only the JDK is offered. JavaFX is no longer included in the JDK. Now it will be downloaded separately. Updated packaging format for Windows has changed from tar.gz to .zip and updated package format for macOS has changed from .app to .dmg.
Now find the Java 11 new features in detail.

1. Collection.toArray(IntFunction)

The java.util.Collection has introduced a new default toArray method as following.
default <T> T[] toArray(IntFunction<T[]> generator) 
The Collection.toArray returns an array containing all of the elements in the collection generated by given IntFunction.
Find the Example.
package com.concretepage;
import java.util.Arrays;
import java.util.Collection;
import java.util.function.IntFunction;
public class ToArray {
  public static void main(String[] args) {
   System.out.println("--- Example 1 ---");
   Collection<Integer> collection1 = Arrays.asList(10, 20 , 30);
   IntFunction<Integer[]> generator1 = Integer[]::new;
   Integer[] arr = collection1.toArray(generator1);
   for (int e : arr) {
   System.out.println("--- Example 2 ---");	
   Collection<String> collection2 = Arrays.asList("Mohan", "Sohan", "Ramesh");
   IntFunction<String[]> generator2 = String[]::new;
   String[] str = collection2.toArray(generator2);
   for (String e : str) {
--- Example 1 ---
--- Example 2 ---

2. JEP 323: Local-Variable Syntax for Lambda Parameters

For uniformity with local variables, Java allows var for the formal parameters of an implicitly typed lambda expression.
(var x, var y) -> x + y 
It is equivalent to:
(x, y) -> x + y 
We cannot mix 'var' and 'no var'.
(var x, y) -> x + y //invalid
(var x, int y) -> x + y //invalid 

3. JEP 327 Unicode 10

The JDK 11 release includes support for Unicode 10.0.0. JDK 11 combines Unicode 9.0.0 and 10.0.0 versions including 16,018 new characters, 18 new blocks, 10 new scripts.
The added characters are 19 symbols for the new 4K TV standard, Bitcoin sign, 128 emoji characters etc.
The added blocks are Cyrillic Extended-C, Mongolian Supplement, Tangut Components etc.
The added scripts are Adlam, Bhaiksuki, Marchen etc.

4. Locale Data Updated to Unicode CLDR Version 33

The locale data based on the Unicode Consortium's CLDR has been updated for JDK 11. Localized digits that are in supplementary planes are substituted with ASCII digits until JDK-8204092 is resolved.

5. Lazy Allocation of Compiler Threads

Find the new command line tag added in Java 11 to dynamically control compiler threads.
In tiered compilation mode, which is default mode, VM starts a large number of compiler threads on system, regardless of available memory and compilation requests. We can control the compiler threads with this new command.

6. JEP 331 Low-Overhead Heap Profiling

JEP 331 provides low overhead way of sampling heap profiling accessible via JVMTI.
Find its advantages.
a. Low-overhead enough to be continuously enabled by default
b. Accessible via a well-defined, programmatic interface (JVMTI)

7. JEP 181 Nest-Based Access Control

In Java 11, JVM supports nest based access control. Nest is the new arrangement of classes and interfaces for access control context. Nest allows accessing each other’s private members without the need for compilers to insert accessibility-broadening bridge methods. Membership in a nest is exposed through the new getNestHost and getNestMembers methods of java.lang.Class.

8. JEP 324 Key Agreement with Curve25519 and Curve448

JEP 324 adds an implementation of a new key agreement scheme using Curve25519 and Curve448 as described in RFC 7748.

9. Brainpool EC Support (RFC 5639)

In Java 11, Brainpool EC Support (RFC 5639) has been added. The SunEC provider has been enhanced to support 4 additional Brainpool curves as defined in RFC 5639, Elliptic Curve Cryptography (ECC) Brainpool Standard Curves and Curve Generation.

10. JEP 329 ChaCha20 and Poly1305 Cryptographic Algorithms

Those wishing to obtain an instance of the ChaCha20 stream cipher may use the algorithm string "ChaCha20" with the Cipher.getInstance method. Those wishing to use ChaCha20 in AEAD mode with the Poly1305 authenticator may use the algorithm string "ChaCha20-Poly1305".

11. Enhanced KeyStore Mechanisms

A new security property jceks.key.serialFilter has been added to enhance KeyStore mechanism.

12. RSASSA-PSS Signature Support Added to SunMSCAPI

The RSASSA-PSS signature algorithm support has been added to the SunMSCAPI provider.

13. JEP 332 Transport Layer Security (TLS) 1.3

The JDK 11 release includes an implementation of the Transport Layer Security (TLS) 1.3 specification (RFC 8446).

14. Support for AES Encryption with HMAC-SHA2

The Kerberos 5 encryption types of aes128-cts-hmac-sha256-128 and aes256-cts-hmac-sha384-192 defined in RFC 8009 are supported. These encryption types are enabled by default.

15. JEP 330 Launch Single-File Source-Code Programs

Enhance the java launcher to run a program supplied as a single file of Java source code, including usage from within a script by means of "shebang" files and related techniques.

16. JEP 321 HTTP Client (Standard)

The HTTP client has been standardized in Java 11. Now the jdk.incubator.http package has been removed and the API imported from this package needs to updated from java.net.http package.


JDK 11 Release Notes

©2020 concretepage.com | Privacy Policy | Contact Us