Effective Java! Prefer Method References to Lambdas

One of the main benefits of lambdas is the conciseness of the code versus the use of an anonymous class. Even so, there are times that even lambdas end up with unnecessary boilerplate. In these cases we can often make use of method references which is something we even saw used in our last post.

Method references are really just that, a reference to a method that allows us to skip the boilerplate of simply passing parameters from one place to another. Let’s look at an extremely simple example: