New APIs & Options


JDK 10 launched has added 70+ new APIs and Options in the Java library. Some important intensifications introduced are given below.

Optional.orElseThrow() Method

A new way orElseThrow() is accessible in java.util.Optional class is now a favourable alternative for get() way.

APIs to create Unmodifiable Collections

A new way copyOf() is accessible in List, Set and Map interfaces which can make new group instances from the present one. Collector class has new ways toUnmodifiableList(), toUnmodifiableSet(), and toUnmodifiableMap() to acquire components of a stream into an unmodifiable troupe.

Disable JRE Last Usage Tracking

A new flag is inaugurated jdk.disableLastUsageTracking which disables JRE's last utilization tracking for a processing VM.

Hashed Password

The plain text written passwords accessible in the jmxremote.password files are now being overwritten with their SHA3-512 hash by the JMX agent.

Javadoc Support for Multiple Stylesheets

A new option is accessible to the javadoc command as --add-stylesheet. This option hold up the use of multiple stylesheets in created documentation.

Javadoc Support for Overriding Methods

A new option is accessible to the Javadoc command as --overridden-methods=value. As many classes override inherited ways but do not interchange the definition. The --overridden-methods=value option permits to group these ways with any other inherited methods, rather than documenting them again individually.

Javadoc Support for Summary

A new inline tag, {@summary ...}, is accessible to define the text to be used as the sum up of the API explanation. By default, the sum up of an API description is concluded from the very first sentence.


The use of some of the new APIs in JAVA 10, will be shown in the given example.

import java.util.List;
import java.util.stream.Collectors;

public class Tester {
   public static void main(String[] args) {
      var ids = List.of(1, 2, 3, 4, 5); 
      try {
         // get an unmodifiable list
         List<Integer> copyOfIds = List.copyOf(ids);
      } catch(UnsupportedOperationException e){
         System.out.println("Collection is not modifiable.");
         // get an unmodifiable list
         List<Integer> evenNumbers = ids.stream()
            .filter(i -> i % 2 == 0)
      }catch(UnsupportedOperationException e){
        System.out.println("Collection is not modifiable.");


Your outcome will look like this

Collection is not modifiable.
Collection is not modifiable.