Java: Lambda Expressions
Shorter, cleaner code using anonymous functions
Lambda expressions were introduced in Java 8. They provide a much cleaner syntax than previous Java versions for the solution to several common programming tasks in Java. Here are some examples
- writing a custom sort for an
ArrayList
of objects (or anyCollection
of objects) - writing event handlers for Swing GUIs
- writing event handlers for web applications