The construct inside a function call 's argument list indicates the beginning of a lambda expression .
在一个函数调用的参数表内出现的方括弧构造,以之标示出一个lambda表达式的存在。
This is similar to a lambda and similar constructs used in many other languages .
这和其它语言中的lambda表达式或类似结构相似。
Lambda functions remove all the need for the scaffolding code , and allow a predicate function to be defined in-line in another statement .
lambda函数移除了对这些搭架子代码的需求,并允许在另外的一个声明中定义一个谓词函数。
If capture of mutable locals were allowed , the platform would need to extend the local variable 's lifetime for as long as the dynamic lifetime of any lambda expression that captures it .
The final part of the lambda is the function body , which in this case simply adds the value of the x parameter to the total variable .
lambda的最后一部分是函数的主体,这个例子中就是将参数x的值加到变量total中去。
So instead of function types , lambda expressions in java se 8 will bring along a different friend , sam conversion .
所以,javase8中的lambda表达式带来的朋友不是函数类型,而是sam转换。
If a pattern matching fails in a lambda , a runtime error occurs , so be careful when pattern matching in lambdas !
lambda的模式匹配若失败,就会引发一个运行时错误,所以要慎用!
Because the lambda expression has the right argument and return types , the compiler verifies that it can be converted into a comparator and generates the appropriate code for doing so . This is called sam conversion .