lambda expression

A short anonymous function written inline and passed to other code, such as a condition for a filter.

In more detail

Lambdas let you hand behaviour, such as a filter condition, to a method without declaring a named function. Many languages write them with an arrow, such as x => x * 2 in C# or x -> x * 2 in Java.

Examples

Java: name -> name.startsWith("A"); a lambda implements a functional interface such as Predicate.
() -> 6 * 7

Related terms

Taught in

References

Certification courses