List of utility methods to do List Join
String | join(List extends CharSequence> s, String delimiter) join int capacity = 0; int delimLength = delimiter.length(); Iterator<? extends CharSequence> iter = s.iterator(); if (iter.hasNext()) { capacity += iter.next().length() + delimLength; StringBuilder buffer = new StringBuilder(capacity); iter = s.iterator(); ... |
String | join(List extends Object> items, String conjunction) String.join is available only with Java 1.8. StringBuilder sb = new StringBuilder(); boolean first = true; for (Object x : items) { if (first) { first = false; } else { sb.append(conjunction); if (x == null) { sb.append("<null>"); } else { sb.append(x.toString()); return sb.toString(); |
String | join(List extends Object> items, String separator) join StringBuilder sb = new StringBuilder(); for (int i = 0; i < items.size(); i++) { if (i > 0) { sb.append(separator); sb.append(items.get(i).toString()); return sb.toString(); ... |
String | join(List extends Object> list) join return join(list, DELIM);
|
String | join(List extends Object> olist, String glue) join return olist.toString();
|
String | join(List extends Object> valueList, String separator) join if (valueList == null || valueList.size() == 0) { throw new IllegalArgumentException("valueList might not be null or empty!"); if (separator == null) { throw new IllegalArgumentException("separator might not be null!"); StringBuilder sb = new StringBuilder(); for (int i = 0; i < valueList.size(); i++) { ... |
String | join(List extends Object> words, String iDelimiter) Join a list of words into a single string using the specified delimiter. StringBuilder str = new StringBuilder(); if (words.size() == 0) { return str.toString(); int i; for (i = 0; i < words.size() - 1; i++) { str.append(words.get(i)); str.append(iDelimiter); ... |
List | join(List extends T> list, T element) Creates a list that contains all elements of a given list with an additional appended element. List<T> result = new ArrayList<T>(list.size() + 1); result.addAll(list); result.add(element); return result; |
String | join(List> _items, String _delim) join if (null == _items) { return null; return join(_items.toArray(), _delim); |
String | join(List> arr, String seperator) join StringBuilder str = new StringBuilder(); boolean isFirst = true; for (Object item : arr) { if (!isFirst) { str.append(seperator); str.append(item); isFirst = false; ... |