Java Utililty Methods List Concatenate

List of utility methods to do List Concatenate

Description

The list of methods to do List Concatenate are organized into topic(s).

Method

StringconcatinateStrings(List strList, String delim)
concatinate Strings
StringBuffer sb = new StringBuffer();
for (Iterator i = strList.iterator(); i.hasNext();) {
    sb.append(i.next());
    if (i.hasNext())
        sb.append(delim);
return sb.toString();
ArrayListconcatIntegersToRanges(List damages)
concat Integers To Ranges
ArrayList<int[]> ranges = new ArrayList<int[]>();
if (damages.size() == 0)
    return ranges;
Collections.sort(damages);
int start = -1;
int next = 0;
for (Integer i : damages) {
    if (start == -1) {
...
StringconcatLines(List lines)
Combines the specified list into a single String .
StringBuilder sb = new StringBuilder();
for (String line : lines) {
    sb.append(line);
    sb.append(LINE_BREAK);
return sb.toString();
StringconcatLines(List lines)
Returns a concatenated string consisting of the given lines seperated by a new line character \n.
StringBuilder builder = new StringBuilder();
int countMinus1 = lines.size() - 1;
for (int i = 0; i < countMinus1; i++) {
    builder.append(lines.get(i)).append('\n');
if (!lines.isEmpty()) {
    builder.append(lines.get(countMinus1));
return builder.toString();
StringconcatLineSeparated(List discountCommentCauseList)
Concat a List of Strings separated by a \n\n
String result = "";
for (String discountCommentCause : discountCommentCauseList) {
    result += discountCommentCause + "\n\n";
if (discountCommentCauseList.size() > 0) {
    result = result.substring(0, result.lastIndexOf("\n\n"));
return result;
...
StringconcatList(List list)
concat List
return concatList(list, "\n");
ListconcatList(List... array)
concat List
if (array == null || array.length < 1) {
    return Collections.emptyList();
List<E> newList = new ArrayList<E>();
for (List<E> e : array) {
    if (isNotEmpty(e)) {
        newList.addAll(e);
return newList;
CharSequenceconcatList(List strings)
concat List
if (null == strings) {
    return EMPTY_STRINGBUFFER.subSequence(0, EMPTY_STRINGBUFFER.length());
int initialSize = 0;
for (String s : strings) {
    initialSize += s.length() + 2;
StringBuilder builder = new StringBuilder(initialSize);
...
StringconcatListToString(List suggestedList)
concat List To String
String suggestedWords = new String();
for (int i = 0; i < suggestedList.size(); i++) {
    String word = suggestedList.get(i);
    suggestedWords = addWord(suggestedWords, word);
    suggestedWords = trimIfLastIndex(suggestedList, suggestedWords, i);
return suggestedWords;
StringconcatName(String name, List names)
concat Name
names.add(name);
Collections.sort(names);
StringBuilder sb = new StringBuilder();
for (String id : names) {
    sb.append(id);
return sb.toString();