Dissecting a lambda expression will reveal three main parts, as shown in the following diagram:
The following is a description of each part of a lambda expression:
- On the left-hand side of the arrow, we have the parameters of this lambda that are used in the lambda body. These are the parameters of the FilenameFilter.accept(File folder, String fileName) method.
- On the right-hand of the arrow, we have the lambda body, which in this case checks if the folder in which the file was found can be read and if the file name ends with the .pdf suffix.
- The arrow is just a separator of the lambda's parameters and body.