Java Collection Join join(String delim, Collection col)

Here you can find the source of join(String delim, Collection col)

Description

join

License

Open Source License

Declaration

private static String join(String delim, Collection<?> col) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;
import java.util.Iterator;

public class Main {
    private static String join(String delim, Collection<?> col) {
        StringBuilder sb = new StringBuilder();
        Iterator<?> iter = col.iterator();
        if (iter.hasNext())
            sb.append(iter.next().toString());
        while (iter.hasNext()) {
            sb.append(delim);//from   ww w  .j  av a 2 s.  c  om
            sb.append(iter.next().toString());
        }
        return sb.toString();
    }
}

Related

  1. join(final String separator, final Collection objects)
  2. join(Iterable collection, String delimiter)
  3. join(Iterable collection)
  4. join(String c, Collection d)
  5. join(String delim, Collection list)
  6. join(String delim, Collection values)
  7. join(String delim, Collection collections)
  8. join(String delim, Collection values)
  9. join(String delimeter, Collection items)