Java Utililty Methods Collection Concatenate

List of utility methods to do Collection Concatenate

Description

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

Method

Stringconcatenate(final Collection objects, final String separator)
concatenate
final StringBuffer buffer = new StringBuffer();
if (objects != null) {
    for (Iterator<String> iterator = objects.iterator(); iterator.hasNext();) {
        buffer.append(iterator.next());
        buffer.append(separator);
return concatenate(objects, null, separator);
...
StringconcatenatedLTL(Collection ltl)
concatenated LTL
String ltlString = "";
for (String string : ltl) {
    if (!ltlString.equals(""))
        ltlString = ltlString.concat(" || " + string);
    else
        ltlString = ltlString.concat(string);
return ltlString;
...
StringconcatenateIds(final Collection ids)
concatenate Ids
String concatIds = "";
for (Object id : ids) {
    concatIds += "'" + id.toString() + "',";
return concatIds.substring(0, concatIds.length() - 1);
StringconcatenateWithComma(Collection collection)
concatenate With Comma
StringBuilder sb = new StringBuilder();
boolean first = true;
for (String ss : collection) {
    if (!first) {
        sb.append(", ");
    } else {
        first = false;
    sb.append(ss);
return sb.toString();
StringconcatEntries(Collection coll, String sep, String lastSep)
concat Entries
if (lastSep == null) {
    lastSep = sep;
int len = coll.size();
StringBuilder sb = new StringBuilder(16 + (len << 3));
Iterator<?> it = coll.iterator();
int i = 0;
while (it.hasNext()) {
...
int[]concatInt(Collection collection)
Make in one tab the collection of tabs
int length = 0;
for (int[] tab : collection) {
    length += tab.length;
int[] toReturn = new int[length];
int offset = 0;
for (int[] tab : collection) {
    System.arraycopy(tab, 0, toReturn, offset, tab.length);
...
StringconcatNames(Collection cNames, String split)
concat Names
String cNames$ = "";
for (String name : cNames)
    cNames$ += name + split;
if (cNames$.length() > 0)
    cNames$ = cNames$.substring(0, cNames$.length() - 1);
return cNames$;
StringconcatNumber(Collection keys)
concat Number
StringBuffer res = new StringBuffer();
for (Number key : keys) {
    res.append(key);
    res.append(',');
res.deleteCharAt(res.length() - 1);
return res.toString();
StringconcatStrings(Collection strings)
Takes Collection of Strings and returns them as a single line of comma separated strings.
return concatStrings(strings.toArray(new String[strings.size()]));
StringconcatStrings(Collection values, String separator)
concat Strings
StringBuffer concatedValues = new StringBuffer();
if (null == values) {
    return concatedValues.toString();
boolean first = true;
Iterator<String> valuesIter = values.iterator();
while (valuesIter.hasNext()) {
    if (!first) {
...