code: protected void performScan(Collection<File> created, Collection<File> modified, Collection<File> deleted) {
  
          final LinkedHashMap<String, FileInfo> prevScanResult = inMemoryScanResults;
          final LinkedHashMap<String, FileInfo> newScanResult = new LinkedHashMap<String, FileInfo>();
  
          // Check that directory exists
          if (!monitoredFile.isDirectory()) {
              // Directory does not exist or was removed
              // If we had/knew about files before, then all of the files were deleted.. 
              if (prevScanResult != null && !prevScanResult.isEmpty() && deleted != null) {
                  for (Map.Entry<String, FileInfo> entry : prevScanResult.entrySet()) {
                      File f = new File(entry.getKey());
  
                      // Simplify: Make sure only stuff that matches gets
                      // into the cache, and then you can be indiscriminate about what
                      // gets removed.
                      deleted.add(f);
                  }
                  // Add the monitored directory itself to the results.. (if required)
                  if (isIncludeSelf()) {
                      deleted.add(monitoredFile);
                  }
              }
          } else {
              // Directory exists: check only nested resources that match.
              scanDirectory(prevScanResult, newScanResult, monitoredFile, created, modified);
  
              // Add the monitored directory itself to the results.. (if required)
              if (isIncludeSelf()) {
                  boolean isFile = isFile(monitoredFile);
                  if (matches(monitoredFile, isFile)) {
                      scanFile(prevScanResult, newScanResult, monitoredFile, created, modified, isFile);
                  }
              }
  
              // Any remaining in the previous result have been deleted.
              // Notify based on filter settings
              if (deleted != null && prevScanResult != null) {
                  for (Map.Entry<String, FileInfo> entry : prevScanResult.entrySet()) {
                      File f = new File(entry.getKey());
  
                      // Simplify: Make sure only stuff that matches gets into the cache, 
                      // and then you know whatever is leftover in the cache was deleted
                      // (because you know it matches.. )
                      deleted.add(f);
                  }
              }
          }
  
          // replace the referenced map with the new scan result
          inMemoryScanResults = newScanResult;
      }
docs: {@inheritDoc}