A look at Netbeans support for upcoming language enhancements in Java 8

While I was working on the samples for this post using the Nebeans nightly builds with support for Lambda Expressions downloaded from here. I found that the IDE gave good suggestions for converting the code to use the Java 8 support as and where possible. For example I had a small piece of code:
List<Person> olderThan30OldWay = new ArrayList<>();
for ( Person p : personList){
if ( p.age >= 30){
and the IDE showed an yellow line under the for and provided a hint as shown in the screenshot below:
and using the hint resulted in the following code being added in place of the above code:
List<Person> olderThan30OldWay = new ArrayList<>();
personList.stream().filter((p) -> ( p.age >= 30)).forEach((p) -> {
This is going to be really useful for people to identify where the code can be replaced by Lambda Expression. A more detailed intent of experimenting with the above sample can be found in my previous post here.

Categories: Java

Tags: ,

1 reply

  1. The Article is Awesome but i Hate NetBeans to the Core! ……… Love Eclipse forever


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: