Java 8 Released
Whats new in Java 8? Where to start learning?
Last week we saw the new release of Java. Version 8 brings a lot of new features into the language. I think the most important are:
- lambda expressions,
- default method implementations in interfaces,
- new datetime api.
There is also a lot of smaller improvements and additions in the standard library.
I’m a huge fan of the functional programming paradigm and of course I’m very excited about the release. Hope it will be quickly and widely adopted in production. Also the library improvements will make a compelling alternative to popular external libraries like JodaTime and Guava. This is good, because I think everybody were including them, even for small projects.
How to get start with Java 8?
- I can recommend a webinar by Venkat Subramanian - Functional Programming with Java 8 - very good to get started.
- this blog post offers more detailed overview. It is 1 year old, but gives a very good content
- There is also an official Oracle tutorial for lambdas.
If you want to dig into more details of lambdas in Java 8 check these two articles by Brianz Goetz:
This is now Java (example from the latter)
Pattern pattern = Pattern.compile(\\s+"); Map<String, Integer> wordFreq = tracks.stream() .flatMap(t -> pattern.splitAsStream(t.name)) // Stream<String> .collect(groupingBy(s -> s.toUpperCase(), counting()));
Happy coding with Java 8!