Java Collection Join join(CharSequence separator, Collection col)

Here you can find the source of join(CharSequence separator, Collection col)

Description

join

License

Open Source License

Declaration

public static StringBuilder join(CharSequence separator, Collection<?> col) 

Method Source Code

//package com.java2s;
//it under the terms of the GNU Affero General Public License as published by

import java.util.Collection;

import java.util.Iterator;

public class Main {
    public static StringBuilder join(CharSequence separator, Collection<?> col) {
        final StringBuilder result = new StringBuilder();
        if (col != null) {
            for (Iterator<?> it = col.iterator(); it.hasNext();) {
                result.append(it.next());
                if (it.hasNext()) {
                    result.append(separator);
                }// www.  j a va  2  s .  c  om
            }
        }
        return result;
    }
}

Related

  1. implode(Collection items, String join)
  2. internalJoin(String sep, Collection pieces)
  3. isDisjoint(Collection a, Collection b)
  4. join(AbstractCollection s, String delimiter)
  5. join(CharSequence p, Collection collection)
  6. join(Collection c)
  7. join(Collection c, String d)
  8. join(Collection c, String delim)
  9. join(Collection c, String left, String right, String separator)

  10. HOME | Copyright © www.java2s.com 2016