Using a lambda expression, we can make this more compact.
使用lambda表达式,我们可以把这段代码变得更紧凑一些。
Finally, the last expression applies the lambda expression to the list containing (101 102).
最终,最后一个表达式对包含 (101 102)的列表应用这个lambda 表达式。
In this particular example, a method reference is a clearer expression of what we mean than a lambda expression, but the idea is the same.
在这个特殊的例子中,方法引用比lambda表达式更清晰地表达了我们的意图,但它们的概念是一样的。
An expression tree is a data representation of the lambda expression in a form that is easy for you to read and reason about the lambda expression in.
表达式树是lambda表达式的一种数据表示形式,它能使你更方便地读取和推断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.
因为lambda表达式拥有正确的参数和返回类型,编译器将证实可以把这些类型转换成Comparator,并生成完成此操作的相应代码。
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.
如果捕获可变局部变量是允许的行为的话,平台就需要扩展局部变量的生存期,使之与任何捕获该变量的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.
如果捕获可变局部变量是允许的行为的话,平台就需要扩展局部变量的生存期,使之与任何捕获该变量的lambda表达式的动态生存期一样长。
应用推荐