Top Java 10 Features

 

Oracle announced a new version of Java which turned out to be the speediest one for its feature release of the Java SE platform, till now. This is the first release in the newest release schedule, where you get a new Java release after every six months. It has decided to promote Open JDK binaries as primary JDK 10 which reduces the hassle for the big companies to shuffle from the current system every time, a new version is enhanced in every java release. Some of the key highlights in the new java release include application class-data sharing, heap collection as well as local variable types. A few of the prominent new Java 10 features are listed below:

Java 10 features

1. Local Variable Type Inference

It is the newest feature for developers in Java 10. Type inference is Java compiler’s ability to look at each method invocation and corresponding declaration of local variables to determine the type argument or multiple arguments that make the invocation applicable. Local Variable meaning ‘var’ is not a keyword, but it is a reserved type name in the Java Language. So it cannot be used as a method, package, class or interface. Its uses are defined such as:

  • Limited only to Local Variable with an initializer
  • Indexes of enhanced for loops or indexes
  • Local declared in for loop

Let us walk through an example:

var numbers = List.of(1, 2, 3, 4, 5); // inferred value ArrayList<string>
// Index of Enhanced For Loop
for (var number : numbers) {
     System.out.println(number);
}
// Local variable declared in a loop
for (var i = 0; i < numbers.size(); i++) {
      System.out.println(numbers.get(i));
}
</string>

2. Parallel Full GC for G1

With the new Java features (version 10) updated now, source code isolation of different garbage collectors can be improvised with the coming of the new and most common Garbage Collector Interface. It emphasizes on providing better modularity to the internal GC code which in future, will help for adding full garbage collection without changing existing codebase. Also it helps in removing or maintaining the previous GC Parallel.

3. Additional Unicode Language –Tag Extensions

It will enhance the java.util.Locale and related APIs to implement additional Unicode extensions of BCP 47 language tags. This added the support for the below mentioned additional extensions –

  • cu (currency type)
  • fw (first day of the week)
  • rg (region override)
  • tz (time zone)

4. Thread – Local Handshake

A handshake operation is a callback that is executed for each Java Thread while that thread is in a safe point safe state. The callback is implemented by the VM thread while keeping the thread in a blocked state or by the thread itself. It allows executing a callback on threads without performing a global VM safe-point. It is possible and also cost-effective to stop individual threads and not just all threads or none.

5. Heap Allocation on Alternative Memory Devices

Applications such as in-memory databases and big data have an increasing demand for memory. Such applications could use NV-DIMM for the heap since NV-DIMMs has a larger capacity, at lower cost, in comparison to DRAM.Heap Allocation feature enhances the capability of HotSpot VM by allocating the Java object heap on an alternative memory device, such as an NV-DIMM as specified by the user. It also targets alternative memory devices that have the same semantics as a DRAM, including the semantics of atomic operations, and can be used instead of DRAM for the object heap to the existing application code without any change.

6. Root Certificates

Java 10 promotes Open JDK binaries as primary binaries for the ease of using the system without needing to update it frequently.

The cacerts Keystore will be inhabited with a kit of root certificates issued by the CAs of Oracle’s Java SE Root CA Program. Critical security components like TLS will run by default in OpenJDK builds moving forward.

To ensure the integrity and confidentiality, It comprises a default set of root Certification Authority (CA) certificates in the JDK 10 which makes sure that both Oracle JDK 10 & Open JDK binaries will function the same.

7. Application Class – Data sharing

While initiating JVM, it performs some preliminary steps, one of which is loading classes in memory. If there are multiple jars having several classes, then the lag in the first request is simply visible. There arises a problem with serverless architecture, where the boot time is critical. In order to carry forward the application startup time, Application class-data sharing is used that enables the bootstrap class loader to load classes that have been archived. It is to reduce footprint by sharing common class metadata across several Java processes.

8. Removal of the Native-Header Generation Tool – java

It allows removing javah tool from JDK 10. It is not mandatory to remove – it is optional. The tool functionality of javad is added in JDK 8, which helps to generate native header files when compiling JNI code without using javah.

9. Consolidate the JDK Forest into a Single Repository

For a long time, for Java development, several repositories were utilized for the JDK forest codebase. Multiple repositories do provide several advantages, but it also comes with various operational downsides. It helps to combine the numerous repositories of the JDK forest into a single repository for streamlining the development process.

10. Experimental Java-Based JIT Compiler

Graal, as defined in Java 9, is an alternative to the JIT compiler which has been used to plugin to the JVM, meaning that the JIT compiler is not attached with JVM and can be dynamically plugged in or replaced with any other plugin. It also introduces Ahead of Time (AOT) compilation in java. It also supports the interpretation of the polyglot language. This feature enables the Java-based JIT compiler, Graal, to get used as an experimental JIT compiler on the Linux/x64 platform.

11. Time-Based Release Versioning

Time-based release versioning improves the version-string scheme of the Java SE Platform and the JDK 10, and similar versioning data, for today and upcoming release models.

Ending the Line

Overall, it seems that JDK 10 updates provide supportive new features to the java community. It also modifies or merges the features from the older version. By this enhancement, now Java developers have the privilege to code with less time complexity and efficienc. Yet, it also helps the developers to work less on some features and reduce the time complexity.

profile-image
Vishal Shah

Vishal Shah has an extensive understanding of multiple application development frameworks and holds an upper hand with newer trends in order to strive and thrive in the dynamic market. He has nurtured his managerial growth in both technical and business aspects and gives his expertise through his blog posts.

Want to Hire Skilled Developers


    Comments

    • Leave a message...

    Related Articles
    Java lambda Expression
    Java Lambda Expression
    Jan 25, 2021
    Is AWS Lambda a Server-Side Component?
    Jul 10, 2020
    Microservices Implementation in Java
    Jan 25, 2021