a peek into my MIND

July 11, 2011

Finally Java 7 is out

Filed under: Java — Tags: — Bharat Kondeti @ 11:25 pm

Finally after almost 5 years, new version of Java i.e. Java7 is out for developer preview. Unfortunately many of the promised features were left out in this release, features like Lambda, Jigsaw and some part of Coin initiative are moved to Java 8 release which is expected sometime year end of 2012.

Of course with every new release comes new features, better performance, new syntax etc. Some of the noteworthy features

1) One of the biggest feature is invokeDynamic. This makes interactions between Java and other dynamic languages like JRuby, Jython, Groovy and other 200 languages that are on JVM seamless. Now JVM can optimize the bytecode produced by these languages. We can choose to write code in any language that best solves the problem and compile it against JVM to get all the JVM capabilities like optimization, garbage collection etc

2) Second big feature is language enhancements. Biggest complaint about java is that its verbose / or has lot of ceremony in writing code. With project “coin” in Java7 we will see some language enhancements. For ex

Improved type inference for generic instance creation

//In Java 6
Map<String, List<String>> mapoflists = new HashMap<String, List<String>>();

//In Java 7
Map<String, List<String>> mapoflists = new HashMap<>();

Similarly Multi Catch blocks

try {
//Do Something;
catch(Exp1 | Exp2 |Exp3) {
//Do something

more enhancements like strings in switch statements, Binary Integral literals and underscore literals, try with resource statements etc

3) We are in an age where servers with multiple cores are very common. Having language features that enables us to use all these processing power is very helpful. Java7 has enhancements for Concurrent and Collections API that enable us to write applications to use multiple processors.

4) Enhanced NIO

For more features and information follow these links

Oracle Java 7 page

Javalobby Introducing Java 7


Create a free website or blog at WordPress.com.