In this recipe, you will learn how to use a method reference, with the constructor reference being one of the cases.
Using method references
Getting ready
When a one-line lambda expression consists only of a reference to an existing method implemented somewhere else, it is possible to further simplify the lambda notation by using the method reference.
The syntax of the method reference is Location::methodName, where Location indicates where (in which object or class) the methodName method can be found. The two colons (::) serve as a separator between the location and the method name. If there are several methods with the same name at the specified location (because of the method overload), the reference method is identified...