List of utility methods to do List Truncate
List | truncateList(List Returns a truncated version of the specified List .
if (len >= list.size()) return list; ArrayList<T> newList = new ArrayList<T>(len); for (int ii = 0; ii < len; ii++) { newList.add(list.get(ii)); return newList; |
List | truncateStringList(List Removes all entries in the list after truncateFrom string (inclusive truncateFrom entry) if (strings == null) return null; int index = strings.indexOf(truncateFrom); if (index >= 0) return strings.subList(0, index); return strings; |
List | truncateVersionFromModFileName(List truncate Version From Mod File Name String pattern = "([a-zA-Z0-9\\s-]+)([-_\\s\\[])(.+)(.jar)"; List<String> truncatedNames = new ArrayList<>(); for (String fileName : fileNames) { String newName = fileName.replaceAll(pattern, "$1"); truncatedNames.add(newName.trim()); return truncatedNames; |