dev notes

Java 8

02 Jan 2014

Tag: java, lambda

New Features:


JSR335 support programming in a multicore environment by adding closures and related feature


Lambda expression:

Use it if you are encapsulating a single unit of behavior that you want to pass to other code. For example, you would use a lambda expression if you want a certain action performed on each element of a collection, when a process is completed, or when a process encounters an error.

Use it if you need a simple instance of a functional interface and none of the preceeding criteria apply (for example, you do not need a constructor, a named type, fields, or additional methods).

Functional interface




A sequence of elements supporting sequential and parallel aggregate operations. The following example illustrates an aggregate operation using

                        p -> p.getGender() == Person.Sex.MALE
                                && p.getAge() >= 18
                                && p.getAge() <= 25)
                .map(p -> p.getEmail())
                .forEach(email -> System.out.println(email));

A stream is a sequence of elements. Unlike a collection, it is not a data structure that stores elements. Instead, a stream carries values from a source, such as collection, through a pipeline. A pipeline is a sequence of stream operations, which in this example is filter- map-forEach. In addition, aggregate operations typically accept lambda expressions as parameters, enabling you to customize how they behave.




A Javascript engine, replace Rhino


Project Avatar provides a JavaScript services layer zeroed in on supporting REST, WebSockets and Server-Sent Events, and a rich client side framework that assumes very minor JavaScript knowledge. The services side is focused on building data services using JavaScript, while the optional client side is entirely focused on supporting HTML5 and TSA (Thin Server Architecture).


comments powered by Disqus