More than 3 years after the release of Java 8, the next version, Java9, is now just around the corner with a tentative release date of September 21st, 2017.
I had described Java 9’s module system, Jshell , Interface enhancement in my previous posts, but there’s even more to this new version. Collections factory methods, improved Javadocs, Multi-release jars are often ignored under the shadows of Jshell and Jigsaw Module.
I. Collections factory methods
we often create a list/set and populate it with elements by calling add() several times. This is foolishness called redundancy.
Java9 brings factory method shown below:-
List.of() and Set.of() is new factory methods which helps to instantiate collections.
II. Improved JavaDocs
I hope all of you like me turn to google for finding the right Javadoc page. Oracle finally realise that there is need for good docs. Below is the change :-
- Search box is provided at right side of Javadoc where you can search any related class or interface.
- New Javadoc page also includes information on which JDK module the class or interface comes from.