public static List<String> findChildrensList(final File dir,final boolean searchDirs){
  List<String> files=new ArrayList<>();
  for (  String subFiles : dir.list()) {
    File file=new File(dir + "/" + subFiles);
    if ((searchDirs && file.isDirectory()) || (!searchDirs && !file.isDirectory())) {
      files.add(file.getName());
    }
  }
  return files;
}

public static List < String > findChildrensList ( final File dir , final boolean searchDirs ) { List < String > files = new ArrayList < > ( ) ; for ( String subFiles : dir . list ( ) ) { File file = new File ( dir + "/" + subFiles ) ; if ( ( searchDirs && file . isDirectory ( ) ) || ( ! searchDirs && ! file . isDirectory ( ) ) ) { files . add ( file . getName ( ) ) ; } } return files ; }
gets list of childeren folder or files for dir , according to searchdirs param .
