Tag Archives: lambda expressions

Java 8 – Some of the new features

In this post, some of the new features of JAVA 8…

 

…and here are the results from running the file above

Note that the build fails because we pass null to the Optional and we have a condition to throw an exception if null is passed to it (this is the reason why this line is the last statement of this example).

Thank you! 🙂

 

Java 8 Lambda expressions example

from Pocket http://ift.tt/1o3kOmE

While implementing single method interfaces – often to be passed as a parameter to another function as callbacks – we often end up writing an anonymous class. Considering what we want to achieve, we may come up with something that is unnecessarily verbose.