Search This Blog

Wednesday, November 21, 2018

When to use Lambda expression

If you are encapsulating a single unit of behavior that you want to pass to other code. For example, you would use a lambda expression if you want a certain action performed on each element of a collection, when a process is completed, or when a process encounters an error.

If you need a simple instance of a functional interface and for example, you do not need a constructor, a named type, fields, or additional methods.