Java Collection Join join(Collection paramCollection, String paramString)

Here you can find the source of join(Collection paramCollection, String paramString)

Description

join

License

Apache License

Declaration

public static String join(Collection paramCollection, String paramString) 

Method Source Code


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

import java.util.Collection;

public class Main {
    public static String join(Collection paramCollection, String paramString) {
        StringBuffer localStringBuffer = new StringBuffer();
        //paramCollection = (Collection) paramCollection.iterator();
        while (paramCollection.iterator().hasNext()) {
            localStringBuffer.append("'" + paramCollection.iterator().next() + "'");
            if (!paramCollection.iterator().hasNext())
                continue;
            localStringBuffer.append(paramString);
        }/*from   www  .  j a  v  a 2 s . c o  m*/
        return localStringBuffer.toString();
    }

    public static String toString(Object paramObject) {
        if (paramObject == null)
            return "null";
        return paramObject.toString();
    }
}

Related

  1. join(Collection elements, String separator)
  2. join(Collection items)
  3. join(Collection list, char separator)
  4. join(Collection lst, String delim)
  5. join(Collection objects, String glue)
  6. join(Collection parts, String sep)
  7. join(Collection s, String delimiter)
  8. join(Collection s, String delimiter, boolean doQuote)
  9. join(Collection strings, String sep)