Lambda expression: One of the notations for functions (= anonymous functions) that are defined without naming. Describe arguments and processing.
Lambda expression(Basic grammar)
Function<int> func1 = (int num) -> { return num + 1};
Function<int> func2 = num -> { return num + 2};
Function<int> func3 = num -> num + 3;
If you use a method that takes a lambda expression as an argument, you can pass a part of the process as an argument. ・ Stream related -ReplaceAll of ArrayList ・ Self-made method And so on… As an example, see (the above)
Recommended Posts