Java Collection Join joinCollectionToString(Collection list, String str)

Here you can find the source of joinCollectionToString(Collection list, String str)

Description

join Collection To String

License

Apache License

Declaration

public static <T extends Object> String joinCollectionToString(Collection<T> list, String str) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Collection;

public class Main {
    public static <T extends Object> String joinCollectionToString(Collection<T> list, String str) {
        StringBuffer sb = new StringBuffer(100);
        for (Object entity : list) {
            if (sb.length() > 0) {
                sb.append(str);/*from   w ww .j a va  2s .  co m*/
            }
            sb.append(String.valueOf(entity));
        }
        return sb.toString();
    }
}

Related

  1. joinAsStrings(Collection values, String separator)
  2. joinCol(Collection lst, String delim)
  3. joinCollection(Collection collection, char delimiter)
  4. joinCollection(Collection a)
  5. joinCollections(final Collection target, final Collection... collections)
  6. joinCommaDelimitedList(Collection list)
  7. joinEmptyItemIncluded(Collection stringCollection, String delimiter)
  8. joinList(@SuppressWarnings("rawtypes") Collection c)
  9. joinNullSafe(Collection collection, String separator)