Effective Java! Favor the Use of Standard Functional Interfaces

Kyle Carter
3 min readJun 9, 2021

With lambdas as part of the Java language more possible implementations have opened up. Where before we may have used an alternate pattern such as maybe the Template Method Pattern where a subclass overrides a method to specialize the behavior of the superclass, we can now use a factory method that takes a lambda that serves as the specialization function.

Let’s look at another example, LinkedHashMap. This can serve as a cache by overriding the removeEldestEntry which gets invoked on each put operation with the oldest item…

--

--

Kyle Carter

I'm a software architect that has a passion for software design and sharing with those around me.