Java 11 Features


Java 11 features

What’s New in JDK 11 – New Features and Enhancements. This post includes descriptions of new features and enhancements. There might be compatibility issues that you could encounter when migrating to JDK 11.


1. New Collection.toArray (IntFunction) Default Method in Java 11

A new default method toArray(IntFunction) has been added to the java.util.Collection interface in Java 11. This method allows the collection’s elements to be transferred to a newly created array of a desired runtime type. The new method is an overload of the existing toArray(T[]) method that takes an array instance as an argument.

2. Lazy Allocation of Compiler Threads in Java 11

A new command line flag -XX:+UseDynamicNumberOfCompilerThreads has been added to dynamically control compiler threads. In tiered compilation mode, which is on by default, the VM starts a large number of compiler threads on systems with many CPUs regardless of the available memory and the number of compilation requests in Java 11. Because the threads consume memory even when they are idle (which is almost all of the time), this leads to an inefficient use of resources in Java 11.

3. JEP 318 Epsilon, A No-Op Garbage Collector in Java 11

Epsilon GC is the new experimental no-op garbage collector. Epsilon GC only handles memory allocation, and does not implement any memory reclamation mechanism. It is useful for performance testing, to contrast costs/benefits of other GCs. It can be used to conveniently assert memory footprint and memory pressure in tests in Java 11.

4. JEP 331 Low-Overhead Heap Profiling in Java 11

Provide a low-overhead way of sampling Java heap allocations, accessible via JVMTI (JEP 331).

It is designed to meet the following goals:

  • Low-overhead enough to be continuously enabled by default
  • Accessible via a well-defined, programmatic interface (JVMTI)
  • Can sample all allocations (that is, not limited to allocations that are in one particular heap region or that were allocated in one particular way)
  • Can be defined in an implementation-independent way (that is, without relying on any particular GC algorithm or VM implementation)
  • Can give information about both live and dead Java objects

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

The reserved type name var can now be used when declaring the formal parameters of a lambda expression ([JEP 323]( This builds on the ability in Java SE 10 to use var when declaring local variables.

6. JEP 330 Launch Single-File Source-Code Programs in Java 11

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.

7. Enhanced KeyStore Mechanisms in Java 11

A new security property named jceks.key.serialFilter has been introduced. If this filter is configured, the JCEKS KeyStore uses it during the deserialization of the encrypted Key object stored inside a SecretKeyEntry. If it is not configured or if the filter result is UNDECIDED (for example, none of the patterns match), then the filter configured by jdk.serialFilter is consulted in Java 11.

Did we left something?

Comment down below and share your knowledge with others too , Thanks.

Or Please give your valuable feedback to us...


Author: Saad Mansuri

Leave a Reply

Your e-mail address will not be published. Required fields are marked *