Showing posts with label Java 8. Show all posts
Showing posts with label Java 8. Show all posts

Thursday, 4 February 2016

Java 8 - Syntax to represent Lambdas

Below is the syntax for representing a Lambda expression :
parameter(s) −> expression(s)
where
  • parameter(s) has the following rules:
  1. Optional type declaration
  2. Optional comma, only for more than one parameter
  3. Optional brackets, only for more than one parameter
  • expression(s) has the following rules:
  1. Optional curly braces
  2. Optional return keyword
As quoted from the Oracle site:

"Note that a lambda expression looks a lot like a method declaration; you can consider lambda expressions as anonymous methods—methods without a name."

Java 8 - List of New Features

Among the loads of features added in Java 8, a summary of the most significant features is provided below:
  • Lambda Expressions - enables you to treat functionality as a method argument
  • Method References - easy to read lambda expressions for methods
  • Default Methods -  new functionality added to interfaces
  • Stream API -  functional style operations on collections of elements 
  • Performance Improvement for HashMaps with Key Collisions
  • Java Tool Updates - New jdeps and jjs commands.
  • New Date Time API - New package for Date and Time
  • java.io and java.util Changes - Updates to these packages
  • Nashorn Javascript Engine
For a more detailed information on all the updates, follow this link to the Oracle site.

More information provided on my blog as well. Follow the Java 8 link in the Labels section at the bottom of this post for more information. Oh, and feel free to drop some comments, whether you find the posts helpful or not.

Happy coding!