In a Java 8 introduction mini-book, I saw these implementation for listing hidden files:
File hiddenFiles = mainDirectory.listFiles(f -> f.isHidden());
File hiddenFiles = mainDirectory.listFiles(File::isHidden);
This is a functional interface and can therefore be used as the
assignment target for a lambda expression or method reference.
Evaluation of a method reference expression is distinct from
invocation of the method itself.
At run time, evaluation of a method reference expression is similar to
evaluation of a class instance creation expression
The class implements the targeted functional interface type
A new instance of a class with properties(depends on the expression) is
allocated and initialized, or an existing instance of a class with the
properties below is referenced
The value of a method reference expression is a reference to an
instance of a class with the following properties(depends on the
If you look at JLS 15.27.3, "Type of a Lambda Expression", you will know that the lambda expression is simply an expression that can be assigned to a variable of that functional interface (here your lambda is an expression of a type assignable to
FileFilter. This is because your expression (
File -> boolean) is congruent with the
FileFilter functional interface, and not the
To answer the second part of your question, there is in fact wrapping in a class, as described in JLS 15.27.4.