Java 9 – Factory methods for collections

In Java 9, factory methods are introduced for collections API. Below are examples.

Example:

Output:

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *