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

StringconcatNodeList(List list)
concat Node List
StringBuilder result = new StringBuilder();
result.append("Total List Count: " + list.size() + "\n\n");
for (String item : list) {
    result.append(item).append("\n");
return result.toString();
StringconcatPathTokens(String root, List tokens)
concat Path Tokens
String[] array = new String[tokens.size() + 1];
array[0] = root;
int i = 1;
for (String token : tokens) {
    array[i++] = token;
return concatPathTokens(array);
StringconcatRefs(List refs)
concat Refs
return concat(refs, ' ');
StringconcatString(List args)
concat String
StringBuilder buf = new StringBuilder();
for (String arg : args) {
    if (buf.length() > 0)
        buf.append(' ');
    buf.append(arg);
return buf.toString();
StringconcatStrings(List values, String separator)
Returns concatenated string.
StringBuffer concatedValues = new StringBuffer();
Iterator<String> valuesIter = values.iterator();
if (valuesIter.hasNext()) {
    concatedValues.append(valuesIter.next());
    while (valuesIter.hasNext()) {
        concatedValues.append(separator);
        concatedValues.append(valuesIter.next());
return concatedValues.toString();
ListconcatSuper(List collection1, List collection2)
concat Super
if (isEmpty(collection1)) {
    return collection2;
if (isEmpty(collection2)) {
    return collection1;
List<T> result = createArrayList(collection1.size() + collection2.size());
result.addAll(collection1);
...
ListconcatSynopsises(List prefixes, List ss)
concat Synopsises
List<StringBuilder> newList = new ArrayList<StringBuilder>();
if (prefixes.size() == 0)
    return ss;
for (StringBuilder prefix : prefixes) {
    for (StringBuilder s : ss) {
        newList.add(
                new StringBuilder(prefix.length() + s.length() + 1).append(prefix).append(" ").append(s)); 
return newList;
voidconcatTwoList(List fromList, List toList)
concat Two List
if (fromList == null || toList == null)
    return;
for (int i = 0; i < fromList.size(); i++) {
    Object obj = fromList.get(i);
    if (!toList.contains(obj))
        toList.add(obj);
StringconcatValues(List stringValues, boolean spaceSeparated)
concat Values
StringBuilder builder = new StringBuilder();
String separator = spaceSeparated ? " " : ", ";
for (int x = 0; x < stringValues.size(); ++x) {
    builder.append(stringValues.get(x));
    if (x != stringValues.size() - 1) {
        builder.append(separator);
return builder.toString();
StringconcatWithSeparator(List list, Object delimiter)
Concats a list of objects together using delimiter.
StringBuffer buf;
buf = new StringBuffer();
for (Object i : list) {
    if (i != null) {
        if (buf.length() > 0)
            buf.append(delimiter);
        buf.append(i.toString().trim());
return buf.toString();