lambda : Java Glossary

A lambda is just a terser way to implement an instance of a one-use anonymous class
that has a single method. You don’t have to specify the name of the interface
the class implements, the name of the class or the name of the callback method. You
do not have to specify the types of the parameters, just their names and the
method body. You can leave off the () around the
parameter, if there is only one parameter. You can leave off the ; and the {} around the body if the body is
only one statement (the usual case). The compiler infers all it needs. In return
for all this abbreviation, you must add -> between
the parameters and the method body.

Church’s abstraction of function calls. Delegate objects in Java were always
considerably more clumsy than C/C++’s callbacks or closures in Smalltalk, even
though they were more generic, allowing multiple callbacks and variables to be passed
as a single delegate bundle. Java’s delegates also had the advantage of
structure, implementing an interface. With Java 1.8,
Oracle decided to streamline delegates and allow you to pass little hunks of code as
parameters. These are formally called lambda λ
expressions or closures. You would think this could
be adequately explained in a paragraph or two, however, there are now entire books on
them. I have not yet experimented with them, so, for now, I will have to refer you to
these books.

Lambdas are not quite the same an anonymous classes. They don’t have a
reference to the enclosing class, for example. This allows for speed optimisations,
especially when there are multiple threads.

Java implemented just a small part of lambda calculus. It left out monads, lazy
evaluation, extended immutability.

Why all the fuss over a terser delegate syntax? They make it easier to encapsulate
code for processing entire collections in parallel.

Explanation of lambda expressions aka closures added in Java 1.8. There expressions have been integrated into all parts of Java. This book will help you explore these ramification such as streams, parallelism, concurrency, Collections. The book presumes your are already familiar with other parts of the Java language. This book might be described as lambda immersion. The author rarely shows traditional code then the lambda code equivalent. His examples never show output, so you have no way of verifying if you understood what the code did. For the most part, he talks in abstract academic language, which I found hard to understand. I will have to read this book several times before I understand it. On other hand, I wrote a little bit of code to iterate over a Map with a lambda expression and it worked first time and I fully understood how it worked. You can download the exercises from GitHub I bought an eBook copy of this book on 2014-07-18.