- new Date and Time API(JSR 310)
- Compact Profiles and Project Lambda (JSR 335)
JSR335 support programming in a multicore environment by adding closures and related feature
- closure is a set of local variables, these variable will exist after function executed
- function stack won’t be released after function executed
- define another function inside one function
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).
A sequence of elements supporting sequential and parallel aggregate operations. The following example illustrates an aggregate operation using
personList .stream() .filter( 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.