Earlier this year, the new version of the Java Programming Language was released. Finally, it enters in the field of the “cool peeps” with some features it should have since years ago, like Lambdas.

“Java developers are now Hipsters again!”

Seen somewhere in the wild internet.

Anyways, I have been reading about and building simple algorithms with it since day one, but, now that I’m using it in a “real world” project, I would like to say some words about how the experience is going.

But firsts things first. The new features!

The new features!

Well, this version surely have a lot of cool new features, so, I would like to point out my personal favorites!

1. Lambda Expression

This is really awesome. A lot of languages have this feature for years now, and for years I’ve been talking about how Java should have this. Now, finally, we have:

Runnable runnable = () -> System.out.println("Run forrest, run!");

Even if the implementation “behind the scenes” is not quite the best, in my humble opinion it is better than the interfaces with all that weird inner classes that we were using before:

Runnable runnable = new Runnable() {
  public void run() {
    System.out.println("Run forrest, run!");

2. The Stream collection types

I have to admit, this is awesome! We can do all sort of things with a DSL that is actually enjoyable to use:

Map<String, String> hash = new HashMap<>();
    .map(entry -> entry.getValue())
    .filter(entry -> entry.startsWith("C"))

There is also methods for parallel sorting and other stuff (parallelStream). Check also the IntStream class.

3. The new Date and Time API

This is another one that was required for years. Basically, they moved the Date/Time API to the java.time package and followed the Joda Time format, with the good thing that most classes are Threadsafe and immutable.

I just can’t wait for Java 8 and the Money API! :moneybag:

4. String.join

I still can’t believe that it take so long…