Rob Spoor wrote:Lambdas can not just replace anonymous inner classes, they can also replace the need for template methods. Instead of creating an abstract base class that has abstract methods that need to be overridden, you can provide lambdas to provide that functionality.
A quick example from some code I've written some time ago; this class has a getter (String -> String), setter ((String, String) -> String) and a remover (String -> ()). Slightly simplified:
Before Java 8, I had to make this class abstract, and provide (anonymous) implementations for using a Map or System properties as a backing mechanism:
This example does seem to save you quite a bit of code but I am not sure if this is a good approach from a design perspective. You now have one class that does one thing in two different ways. I think there is an anti-pattern lurking in there somewhere

Abstract class and two concrete classes looks better to me. Having an interface would probably be even better. Any thoughts?