List of utility methods to do String Join
List | joinedList(T first, T... others) joined List ArrayList<T> list = new ArrayList<T>(); list.add(first); Collections.addAll(list, others); return list; |
String | joinIterable(Iterable join Iterable List<String> list = new ArrayList<String>(); for (String each : element) { list.add(each); return join(list, separator); |
String | joinMap(Map, ?> map) join Map if (map.isEmpty()) { return ""; StringBuilder stringBuilder = new StringBuilder(); boolean notFirst = false; for (Map.Entry<?, ?> entry : map.entrySet()) { if (notFirst) { stringBuilder.append(','); ... |
String | joinMap(String keyValueSeperator, String recordSeperator, Map join the key value pairs of a map into one string, i.e. if (map.size() < 1) { return null; String joinedKeyValues[] = new String[map.size()]; int index = 0; for (L key : map.keySet()) { joinedKeyValues[index++] = String.format("%s%s%s", key.toString(), keyValueSeperator, map.get(key).toString()); ... |
void | JoinMaps(Map into, Map other) Join Maps if (other == null) return; Iterator it = other.keySet().iterator(); while (it.hasNext()) { Object prot = it.next(); into.put(prot, other.get(prot)); |
String | joinPath(String part1, String part2) join Path final List<String> parts = new ArrayList<>(); addPathPart(parts, part1); addPathPart(parts, part2); return join(parts, "/"); |
String | joinPaths(String... paths) Concatenates multiple paths and separates them with '/'. Consecutive slashes will be reduced to a single slash in the resulting string. String result = listAsString(Arrays.asList(paths), "/"); result = result.replaceAll("/+", "/"); return result; |
String | joinRepeat(int size, String s, String delim) join Repeat return join(repeatList(size, s), delim);
|
String[] | joinSplit(String record, String regex) join Split String[] split = record.split(regex); Collection<String> elements = new ArrayList<String>(); for (int i = 1; i < split.length; i++) { regex = (regex.indexOf("|") != -1) ? regex.substring(0, regex.indexOf("|")) : regex; elements.add(regex + split[i]); return elements.toArray(new String[0]); |
String | joinString(String separator, String... elements) join String return joinString(elements, separator);
|