Saturday 27 February 2016

Java 8 Lambda Expressions.

Introduction.

Java version 8 adds a few of succint (terse, short, expressive) notations, compared to previous versions of that programming language.

There's more in Java 8 as well.


Lambda notation.



A comparison,
Java 8 lambda-notation vs. a pre-8 verbose notation.


... a source code file is available for download.


Method references.



A comparison,
Java 8 method-refence notation vs. a pre-8 verbose notation.


... a source code file is available for download.




Values can be applied to a static method references.


... a source code file is available for download.




Method references can be passed around & used in expressions,

Comparator class & BiFunction class are not in the same inheritance tree.


... a source code file is available for download.


Syntax conveniences.

... there are cases where we do not have to use complex instructions, delimited by brackets: { }.

... there are cases where we do not have to use a 'return' keyword, as last instruction's expression value is returned by default anyway.


Notes.

... it seems that most probably there's reflection involved with Java 8 Lambda Calculus.

No comments:

Post a Comment