public static List<String> findFileListWithCache(List<String> sourceDirectoryList,Properties cacheProperties,String fileSuffix,String somethingAppendToRear,boolean isFile,boolean includeHidden,CacheProcessor cacheProcessor){
  List<String> sourceList=new ArrayList<String>();
  if (cacheProperties == null) {
    if (sourceDirectoryList != null && !sourceDirectoryList.isEmpty()) {
      for (      String sourceDirectory : sourceDirectoryList) {
        if (isFile) {
          sourceList.addAll(FileUtil.findMatchFile(sourceDirectory,fileSuffix,includeHidden));
        }
 else {
          sourceList.addAll(FileUtil.findMatchFileDirectory(sourceDirectory,fileSuffix,somethingAppendToRear,includeHidden));
        }
      }
    }
  }
 else   if (cacheProperties.isEmpty()) {
    List<String> fileList=new ArrayList<String>();
    if (sourceDirectoryList != null && !sourceDirectoryList.isEmpty()) {
      for (      String sourceDirectory : sourceDirectoryList) {
        fileList.addAll(FileUtil.findMatchFile(sourceDirectory,fileSuffix,includeHidden));
      }
    }
    for (    String fullFilename : fileList) {
      String cacheKey=fullFilename;
      if (cacheProcessor != null) {
        cacheKey=cacheProcessor.keyProcess(cacheKey);
      }
      cacheProperties.setProperty(cacheKey,Generator.md5File(fullFilename));
    }
    if (isFile) {
      sourceList.addAll(fileList);
    }
 else {
      if (sourceDirectoryList != null && !sourceDirectoryList.isEmpty()) {
        for (        String sourceDirectory : sourceDirectoryList) {
          sourceList.addAll(FileUtil.findMatchFileDirectory(sourceDirectory,fileSuffix,somethingAppendToRear,includeHidden));
        }
      }
    }
  }
 else {
    List<String> fileList=new ArrayList<String>();
    if (sourceDirectoryList != null && !sourceDirectoryList.isEmpty()) {
      for (      String sourceDirectory : sourceDirectoryList) {
        fileList.addAll(FileUtil.findMatchFile(sourceDirectory,fileSuffix,includeHidden));
      }
    }
    for (    String fullFilename : fileList) {
      String cacheKey=fullFilename;
      if (cacheProcessor != null) {
        cacheKey=cacheProcessor.keyProcess(cacheKey);
      }
      String sourceFileMd5=Generator.md5File(fullFilename);
      if (cacheProperties.containsKey(cacheKey)) {
        String md5=cacheProperties.getProperty(cacheKey);
        if (!sourceFileMd5.equals(md5)) {
          sourceList.add(fullFilename);
          cacheProperties.setProperty(cacheKey,sourceFileMd5);
        }
      }
 else {
        sourceList.add(fullFilename);
        cacheProperties.setProperty(cacheKey,sourceFileMd5);
      }
    }
  }
  return sourceList;
}

public static List < String > findFileListWithCache ( List < String > sourceDirectoryList , Properties cacheProperties , String fileSuffix , String somethingAppendToRear , boolean isFile , boolean includeHidden , CacheProcessor cacheProcessor ) { List < String > sourceList = new ArrayList < String > ( ) ; if ( cacheProperties == null ) { if ( sourceDirectoryList != null && ! sourceDirectoryList . isEmpty ( ) ) { for ( String sourceDirectory : sourceDirectoryList ) { if ( isFile ) { sourceList . addAll ( FileUtil . findMatchFile ( sourceDirectory , fileSuffix , includeHidden ) ) ; } else { sourceList . addAll ( FileUtil . findMatchFileDirectory ( sourceDirectory , fileSuffix , somethingAppendToRear , includeHidden ) ) ; } } } } else if ( cacheProperties . isEmpty ( ) ) { List < String > fileList = new ArrayList < String > ( ) ; if ( sourceDirectoryList != null && ! sourceDirectoryList . isEmpty ( ) ) { for ( String sourceDirectory : sourceDirectoryList ) { fileList . addAll ( FileUtil . findMatchFile ( sourceDirectory , fileSuffix , includeHidden ) ) ; } } for ( String fullFilename : fileList ) { String cacheKey = fullFilename ; if ( cacheProcessor != null ) { cacheKey = cacheProcessor . keyProcess ( cacheKey ) ; } cacheProperties . setProperty ( cacheKey , Generator . md5File ( fullFilename ) ) ; } if ( isFile ) { sourceList . addAll ( fileList ) ; } else { if ( sourceDirectoryList != null && ! sourceDirectoryList . isEmpty ( ) ) { for ( String sourceDirectory : sourceDirectoryList ) { sourceList . addAll ( FileUtil . findMatchFileDirectory ( sourceDirectory , fileSuffix , somethingAppendToRear , includeHidden ) ) ; } } } } else { List < String > fileList = new ArrayList < String > ( ) ; if ( sourceDirectoryList != null && ! sourceDirectoryList . isEmpty ( ) ) { for ( String sourceDirectory : sourceDirectoryList ) { fileList . addAll ( FileUtil . findMatchFile ( sourceDirectory , fileSuffix , includeHidden ) ) ; } } for ( String fullFilename : fileList ) { String cacheKey = fullFilename ; if ( cacheProcessor != null ) { cacheKey = cacheProcessor . keyProcess ( cacheKey ) ; } String sourceFileMd5 = Generator . md5File ( fullFilename ) ; if ( cacheProperties . containsKey ( cacheKey ) ) { String md5 = cacheProperties . getProperty ( cacheKey ) ; if ( ! sourceFileMd5 . equals ( md5 ) ) { sourceList . add ( fullFilename ) ; cacheProperties . setProperty ( cacheKey , sourceFileMd5 ) ; } } else { sourceList . add ( fullFilename ) ; cacheProperties . setProperty ( cacheKey , sourceFileMd5 ) ; } } } return sourceList ; }
find file list with cache
