Java Collection Join join(Collection items)

Here you can find the source of join(Collection items)

Description

join

License

Apache License

Declaration

public static String join(Collection items) 

Method Source Code


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

import java.util.Collection;

public class Main {
    public static String join(Collection items) {
        StringBuilder result = new StringBuilder();
        boolean first = true;
        for (Object o : items) {
            if (!first) {
                result.append(",");
            }//w  w w  . j a  v a 2  s  .c o m
            if (o != null) {
                result.append(o);
            }
            first = false;
        }
        return result.toString();
    }
}

Related

  1. join(Collection collection, String separator)
  2. join(Collection collection, String separator)
  3. join(Collection collection, String separator, boolean trailing)
  4. join(Collection data)
  5. join(Collection elements, String separator)
  6. join(Collection list, char separator)
  7. join(Collection lst, String delim)
  8. join(Collection objects, String glue)
  9. join(Collection paramCollection, String paramString)