9 Big Things about Java 9
September 15, 2017

9 Big Things about Java 9

According to the latest Tiobe index of programming language popularity, Java tops the list.  No wonder there is so much buzz around the new Java 9 release, set for September 21, 2017.  Take a walk through with our expert.

Many compiled languages include tools for statements interpretation. By using these REPL tools you can rapidly test code snippets without creating a project.

Take Scala, as an example. Compilation can be time consuming, but by using REPL, each statement is executed instantly! That’s great when you are getting started with the language. Each expression returns a value and type, which is valuable information to have.

On the other hand, in Java, we would need to create a test or main method that prints results and must be recompiled every time someone makes a change.

9 Big Things about Java 99 Big Things about Java 92. COLLECTIONS API FACTORY METHODS

The added static factory methods help create collections in variety of small cases.

9 Big Things about Java 9

This come to life due to static interface methods. Thus collections are immutable.

9 Big Things about Java 93. COMPACT  STRINGS

Java 9 provides new and improved strings which, in most cases, will reduce String memory consumption by half.

Instead of having a char[] array, String is now represented as a byte[] array. Depending on which characters it contains, it will use either UTF-16 or Latin-1 to produce either one or two bytes per character.

There is a also new field inside the String class–coder that indicates which variant is used. Unlike Compressed Strings, this feature is enabled by default. If necessary, as in a case where mainly UTF-16 Strings are used, it can be disabled by  -XX:-CompactStrings.


At last, Java9 adds an or() method to Optional API, which allows for the return of different chained optionals without calling isPresent() each time.

9 Big Things about Java 9

In addition, Java9 can create Stream out of Optional with no more than 1 element inside, which is a real advantage when «lazy» mapping is needed.

9 Big Things about Java 9

And, as the cherry on the cake, Java9 will have an ifPresentOrElse() method in Optional API.

9 Big Things about Java 95. COMPLETABLE FUTURE

This class was polished and several methods were added, but most notable is copy(). This method returns immutable copy for CompletableFuture.

9 Big Things about Java 9

But the coolest thing is that stopping an ancestor will affect the child!

9 Big Things about Java 9

Timeouts were also added to the API. Now it is possible to define how CF should finish after time runs out.

9 Big Things about Java 96. STREAMS

With the excellent additions of dropWhile() and takeWhile() to Stream API, there is now option to skip loop and use the stream iterate() method instead.

9 Big Things about Java 97. PROCESS HANDLE API

When starting Java9, there is now a straight and simple access to process handling.9 Big Things about Java 98. JAVA LANGUAGE ENHANCEMENT

Just in case if someone still uses it, «_» is no longer a legitimate identifier. In this case you should use « __» instead (but you don’t 😉 )

9 Big Things about Java 9

Private methods inside Interfaces.

9 Big Things about Java 9

Now with Java9 we are able to use final variables inside try-with-resources effectively.

9 Big Things about Java 99. STACK WALKER AND G1 AS DEFAULT GC

We can now use stack-trace without creating an Exception instance.  We consider this a big improvement.

9 Big Things about Java 9

Starting Java9 G1 will be our default GC. The “Garbage-first” garbage collector, aka G1, is a concurrent multi-threaded GC. It mostly works alongside the application threads much like the concurrent mark sweep GC, and is designed to offer shorter, more predictable pause times while still achieving high throughput. What makes G1 different is that instead of splitting the heap into 3 big regions, it splits it into a set of lots of equal-size. Certain subsets of regions are still assigned roles just like in the other GCs. The amount of live data in each region is tracked, and when a collection is triggered, the G1GC will clear the ones with the most “garbage” first, hence the name. By doing this, it attempts to free as much space as possible with each  collection.


Software Engineer, CoreValue




Recent Articles

Why Consider Enterprise CRM for Your Business.

March 20, 2019 | Sam Senyuk, CTO, Head of R&D
Daryna Hameliak, Sales Operations Analyst, CRM Specialist

At a time of deep uncertainty and tech disruption, businesses are struggling harder than ever to retain customers and keep things under control. We are going to highlight the key points of why a CRM system is one of the most relevant means to do just that. Below, our experts will explain further why an […]

Yuriy Adamchuk Becomes a Member of Lviv IT Cluster Management

March 7, 2019

We are happy to announce that Yuriy Adamchuk, Country Director, Ukraine of CoreValue becomes a member of Lviv IT Cluster Supervisory Board CoreValue joined Lviv IT Cluster in 2016. This is a community of leading information technology companies that, together with local authorities and universities, work on development, support and promotion of the IT industry […]

Contact Us