Java 8 is jammed packed with some cool features such as streams, lambdas, passing code into methods, dates and default interface methods. While many of us working in corporate world won’t get to use them until 2030, it is still fun learning. This weekend I started updating examples to utilize new features in Java 8 and so far “I will hate my job every day until we move to Java 8”. Well, maybe not to that extreme but it will be difficult knowing there is an easier way so I will just chalk it up to an opportunity to share with others.
If you are looking to get started you need to download jdk 8 early access release and compatible IDE. Since there isn’t an official release of Java 8, eclipse doesn’t offer an official build so you will need to download the latest maintenance build. Netbeans has preliminary JDK8 support and is available download through the daily builds. Also, don’t forget to change your default compiler to java 8.
Below is a few links that I found helpful:
- Java 8 Lambdas in Action
- Java Trails Lambda Expressions
- Java 8: Lambdas Part 1
- A virtual jug "55 New features in java SE 8" on Wednesday, January 29, 2014
- Java One 2013 sessions pertaining to lambda and java 8 features
Here is a few examples I updated or if you are interested you can check out the change log on gihub:
- Average from list
- Convert collection to map
- Count booleans in list
- Filter a collection
- Filter map by entries
- Max value in list
- Min value in list
If you didn't grown up with a functional language background a few of these concepts will take some time to wrap your head around. It will be interesting on how we educate traditional java developers and how organizations rethink everything from how we get data, to filtering, grouping and ordering with enhancements of java 8.
I will continue working on updating examples and hopefully some screencast.