将列表写入文件，覆盖模式

@param <T> 集合元素类型
@param list 列表
@return 目标文件
@throws IORuntimeException IO异常
14161
public <T> File writeLines(Collection<T> list) throws IORuntimeException {
		return writeLines(list, false);
	}
1084567
public static <T> T randomEle(List<T> list) {
		return randomEle(list, list.size());
	}
10199
public static <T extends Comparable<? super T>> List<T> sort(final List<T> list) {
        Validate.notNull(list, "Cannot execute list sort: list is null");
        final Object[] a = list.toArray();
        Arrays.sort(a);
        
        return fillNewList(a, list.getClass());
    }
1168907
public static <T> File writeLines(Collection<T> list, String path, String charset) throws IORuntimeException {
		return writeLines(list, path, charset, false);
	}
801784
public static Object[] stringListToArray(List<String> list) {
		Object[] params = null;
		if (list != null) {
			params = list.toArray(new String[list.size()]);
		}
		return params;
	}
3563
public static <T> File writeLines(Collection<T> list, File file, Charset charset, boolean isAppend) throws IORuntimeException {
		return FileWriter.create(file, charset).writeLines(list, isAppend);
	}
1112053
public static <T> List<T> emptyToNull(final List<T> list) {
        if (isEmpty(list)) {
            return null;
        } else {
            return list;
        }
    }
112456
public List<String> list(String folder) throws IOException {
      List<String> res = new ArrayList<String>();
      if (path != null) {
        File f = new File(Utilities.path(path, folder));
        if (f.exists() && f.isDirectory())
          for (String s : f.list())
            res.add(s);
      } else {
        for (String s : content.keySet()) {
          if (s.startsWith(folder+"/") && !s.substring(folder.length()+2).contains("/"))
            res.add(s.substring(folder.length()+1));
        }
      }
      return res;
    }
221642
public static <T> List<T> emptyListIfNull(final List<T> list) {
		return list == null ? (List<T>) Collections.EMPTY_LIST : list;
	}
208570
public static <T> Stream<T> sort(Stream<T> list) {
        return list.sorted(COMPARATOR);
    }
620863
public static <T> String listToString(List<T> list) {
    StringBuilder sb = new StringBuilder();
    for (T s : list) {
      if (sb.length() != 0) {
        sb.append(" ");
      }
      sb.append(s);
    }
    return sb.toString();
  }
798474
public static String join(final Collection<String> list, final String delimiter) {
    final StringBuffer buffer = new StringBuffer();
    for (final String str : list) {
      buffer.append(str);
      buffer.append(delimiter);
    }

    return buffer.toString();
  }
221835
public static List<File> listFilesRecursively(File dir) {
		List<File> fileList = newArrayList();
		addFilesRecursively(dir, fileList);
		return fileList;
	}
1202890
public static List<String> getRepeat(List<String> list) {
        List<String> rtn = new ArrayList<>();
        Set<String> idSet = new HashSet<>();

        for (String id : list) {
            if (idSet.contains(id)) {
                rtn.add(id);
            } else {
                idSet.add(id);
            }
        }

        return rtn;
    }
1020864
public static <T extends Collection<String>> T readLines(String path, Charset charset, T collection) throws IORuntimeException {
		return readLines(file(path), charset, collection);
	}
794215
private static void getFilesAndDirs(File dir, List<File> list) {
        File[] files = dir.listFiles();
        for (File element : files) {
            list.add(element);
            if (element.isDirectory()) {
                getFilesAndDirs(element, list);
            }
        }
    }
378035
public static List<File> listFiles(File srcPath) throws IOException
   {
      List<File> result = new ArrayList<File>();

      if (!srcPath.isDirectory())
      {
         throw new IOException(srcPath.getAbsolutePath() + " is a directory");
      }

      for (File subFile : srcPath.listFiles())
      {
         result.add(subFile);
         if (subFile.isDirectory())
         {
            result.addAll(listFiles(subFile));
         }
      }

      return result;
   }