Java List Concatenate concatenate(List aList)

Here you can find the source of concatenate(List aList)

Description

Convenience routine that concatenates the items in the specified list to a String.

License

Open Source License

Declaration

protected static String concatenate(List aList) 

Method Source Code

//package com.java2s;

import java.util.Iterator;
import java.util.List;

public class Main {
    /**//from w w w.j  a v  a2 s  . c o  m
     * Convenience routine that concatenates the items in the specified list to
     * a <code>String</code>.
     */
    protected static String concatenate(List aList) {
        StringBuffer buffer = new StringBuffer();
        Iterator i = aList.iterator();

        if (i.hasNext()) {
            // Get the first item.
            buffer.append(i.next());

            // Concatenate succeeding items separated by spaces.
            while (i.hasNext()) {
                buffer.append(' ');
                buffer.append(i.next());
            }
        }

        return buffer.toString();
    }
}

Related

  1. concatArrays(List arrays, int start, int size)
  2. concatArraysToList(final T[]... arrays)
  3. concatCsvLine(List values, String fieldSeparator)
  4. concateAliases(List aliases)
  5. concatElementsWithBrackets(List input)
  6. concatenate(List> lists)
  7. concatenate(List list1, List list2)
  8. concatenate(List components)
  9. concatenate(List list)

  10. HOME | Copyright © www.java2s.com 2016