Java Reference
In-Depth Information
Notice that
n
and
d
are separated by commas. In general, whenever more than one para-
meter is required, the parameters are specified, separated by commas, in a parenthesized
list on the left side of the lambda operator.
Although the preceding examples used primitive values as the parameter types and re-
turn type of the abstract method defined by a functional interface, there is no restriction
in this regard. For example, the following program declares a functional interface called
StringTest
. It has a method called
test( )
that takes two
String
parameters and returns a
boolean
result. Thus, it can be used to test some condition related to strings. Here, a lambda
expression is created that determines if one string is contained within another: