Java Reference
In-Depth Information
Always in the context of the API for standalone environments, EL 3.0 has added the
ELManager class to provide lower-level APIs that enable the management of the EL
parsing and evaluation environment. With this class, you can import classes or add
your own resolver to ELProcessor .
Lambda expressions
A lambda expression is an anonymous function that consists of one or more para-
meters in brackets (if there are several), the lambda operator ( -> ), and the body of
the lambda expression. The expression: x-> x * x , is a lambda expression used
to determine the square of a number. Basically, lambda expressions save you from
having to create a whole class for a single method or to declare a method for a very
simple operation that will be used once. So, they can help to write more readable
and maintainable code.
A lambda expression can take many forms, as follows:
• It may involve a number of parameters and can be invoked immediately. The
expression: ((x,y,z)->x+y*z)(3,2,4) , returns 11.
• It can be associated with an identifier and invoked later. The expression:
diff = (x,y)-> x-y; diff(10,3) , returns 7.
• It can be passed as an argument to a method or nested within another
lambda expression. The expression: diff=(x,y)->(x-y);diff(10,[
2,6,4,5].stream().filter(s->s < 4).max().get()) , returns 8.
Collection object support
The support of collection objects in the EL 3.0 Specification is done in two ways: the
construction of collection objects and implementation of operations that will be used
to manipulate them.
Collection object construction
Concerning the creation of a collection, EL allow us to create objects of type
java.lang.util.Set , java.lang.util.List , and java.lang.util.Map
dynamically by using an expression or literals.
The different types of object construction are as follows:
Search WWH ::

Custom Search