Why your Organisation should be making that shift to Java 8?

by Ranvir Singh |

In this brave new world of the game changing start-ups, most are known to invest heavily in cutting edge new technologies to solve problems in the most innovative manner possible. On the other hand, the more conventional but successful companies already mature in the market, don’t necessarily share the same risk appetite in new technologies and are mostly risk averse when it comes to adopting the latest and greatest for their IT capabilities. 

Here’s a thought though, how do you stay competitive and relevant in these highly volatile and competitive markets where you face competition from the unlikeliest of places with every new innovative product to enter the market trying to pull the rug from under you? How do you compete in a category where the category itself is being reinvented? If there is a lesson to be learned from the likes of Nokia, Kodak, Blackberry, et al. it’s that at a strategic inflection point your years of significant market leadership position goes out the window and what matter is the asymmetrical bets you have placed on the growth engines of tomorrow backed by a significant investment in new technology. The only survivors would be the Organisations with a culture of innovation, backed by a constant thrust on adapting new systems and technologies to take full advantage of what that latest language or that latest version of a framework have to offer. Rather than just relying on those outdated, albeit robust legacy systems, these innovative companies learn to adapt, quickly launch, improve further and use these new technologies as a springboard for capturing their customer’s imagination.

At Oakton we are always at the forefront of exciting new technological developments to help you better manage your IT capabilities. Our in house Java technical experts are always looking for ways to utilise these advancements in the latest versions of the language and various frameworks to help you with your bespoke IT solutions, resulting in faster turnaround times with fewer issues, and a renewed focus on adding value to the customer experience. That’s how we think.

The below points highlight why your Organisation should be looking to make that jump to the latest and greatest version of Java- Java 8 and the benefits and advantages that comes with being that earlier adaptor of this revolutionary incremental change in the Java world.. Let’s get a bit technical then around the specificities of why exactly should you be making that shift to Java 8:

Remove Verbosity, boilerplate Code and make your code more readable: One of the most talked about features of Java 8 has been the Anonymous function or Lambda expressions. Java 8 brings in the concept of Lambda expression and Functional Interfaces which helps us to avoid writing the unnecessary boilerplate code required only because of the way programs need to be structured in an Object Oriented Programming language like Java. This results in a more streamlined code structure much like how it works in Functional programming language like Scala.

A lambda expression consists of a parentheses enclosed, comma separated list of parameters followed by an Arrow (->) token and a body in curly braces:

(args1, args2, args3, ……) -> { Body }

So currently if we were to say write a piece of code to create an instance of Runnable we need to write a verbose code like below:

Runnable runnable = new Runnable(){


            public void run() {

                System.out.println("Hello World");


But with Java 8, we can use Lambda expressions to instantiate a Functional Interface (an interface with exactly one abstract method) like Runnable, using just the one line below:

 Runnable runnable = () -> System.out.println("Hello World");

As we can see, using Lambda expressions will often remove verbosity from the program, helps remove all those anonymous inner classes, make the code easier to read and require fewer lines of code. This coupled with some other advantages like support for Parallel and Sequential Execution etc. make Java 8 an ideal candidate for your next Java Update.

Faster Sorting: Java 8 brings with it a faster new way of sorting through the introduction of the parallelSort() in the Util package java.util.Arrays.

The Current sorting implementations provided by the Java Collections Framework e.g. Arrays.sort(myArray) perform the sorting operation sequentially within the calling thread. With Java 8, a parallel sort implementation is used as: Arrays.parallelSort(myArray) which utilizes the Fork/Join framework. These new API’s still remain synchronous with regard to the calling thread and does not go past the sorting operation till the parallel sort completes.

As per Oracle’s Java 8 Documentation, the Parallel Sort works by utilizing a sorting algorithm in a parallel sort-merge that breaks all the array into sub-arrays that are themselves sorted and then merged. When the sub-array length reaches a minimum granularity, the sub-array is sorted using the appropriate Arrays.sort() method.

New JavaScript Engine: Java 8 introduces a brand new, next Generation JavaScript scripting engine called Nashorn which replaces the existing interpreter Mozilla Rhino. This would supposedly help with JavaScript integration on the JVM in an efficient and straightforward manner, thus bridging the gap between speeds of execution of JavaScript on JVM compared with Chome/Node.js etc. which utilises the faster V8 JavaScript engine. Nashorn also provide better compliance with the ECMA normalized JavaScript specification and a better runtime performance through invokedynamic- bound call sites.

Strongest SecureRandom Implementation: The introduction of the getInstanceStrong() method in JDK 8, which returns an instance of the strongest SecureRandom implementation available on each native platform is especially useful if you want to use a high-value and long-lived secret, such as an RSA private and public key pair.

Prevent implicit Numeric overflows:  To help deal with the numeric overflow related bugs in cases where the size is int or long, the overflow errors can be easily detected in Java 8’s new ‘Exact’ methods. The methods addExact, subtractExactmultiplyExact, and toIntExact throw an unchecked ArithmeticException when the value of the operation overflows its precision. For other arithmetic operations such as divide, absolute value, increment, decrement, and negation overflow occurs only with a specific minimum or maximum value and should be checked against the minimum or maximum as appropriate.

Stronger Algorithms for Password-Based Encryption: As per Oracle’s Java 8 documentation, several AES-based Password-Based Encryption (PBE) algorithms, such as PBEWithSHA256AndAES_128 and PBEWithSHA512AndAES_256, have been added to the SunJCE provider.

Add functionality to your Interfaces without breaking existing implementations: In today’s fast paced and innovative business world, the introduction of a new features in the shortest possible time to market can be a key contributor to a company’s continued success.

For your bespoke IT applications written in Java, where would you declare these methods related to this shiny new functionality? Adding them as static methods is something you would do for utility methods and not for these essential, core methods but if you add them to your original interfaces, then the programmers would have to rewrite all of their implementations.

This is where the Java 8’s Default Methods comes in, enabling us to add new methods to an interface without causing compilation error and breaking the classes that implements that interface. So with Default methods you can add new functionalities to the Interfaces of your Libraries and APIs while ensuring backward compatibility with older versions of those libraries’ Interfaces since one must provide an implementation for that default method in the Interface.

The idea is that in your Interface, you create a new default method with the default modifier keyword before the method declaration followed by the actual implementation of the method. The class implementing this interface can override the default method implementation if need be. This feature found an important first use in the reengineering of Java 8’s JDK Collection framework which utilises the default Methods to include the forEach method for the entire Collection without breaking any of the classes which extends the Collection Interfaces.




Back to list