How to do it...

Perform the following steps to implement the example:

  1. Create a class named FileSearch and specify that it implements the Runnable interface. This class implements the file search operation:
        public class FileSearch implements Runnable { 
  1. Declare two private String attributes: one named initPath, which will store the initial folder for the search operation, and the other named end, which will store the extension of the files this task is going to look for:
        private String initPath;         private String end; 
  1. Declare a private List<String> attribute named results that will store the full paths of the files that this task has found:
        private List<String> results; 
  1. Implement the constructor of the class that will initialize ...

Get Java 9 Concurrency Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.