Java Iterable Join join(Iterable coll, String sep)

Here you can find the source of join(Iterable coll, String sep)

Description

join

License

Apache License

Declaration

public static <T> String join(Iterable<T> coll, String sep) 

Method Source Code

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

import java.util.Iterator;

public class Main {
    public static <T> String join(Iterable<T> coll, String sep) {
        Iterator<T> it = coll.iterator();
        String ret = "";
        while (it.hasNext()) {
            ret = ret + it.next();/*  ww w.j a va 2  s.  com*/
            if (it.hasNext()) {
                ret = ret + sep;
            }
        }
        return ret;
    }
}

Related

  1. join(Iterable strings, String delimiter)
  2. join(Iterable strings, String separator)
  3. join(Iterable array, String joiner)
  4. join(Iterable coll, String sep)
  5. join(Iterable coll, String sep)
  6. join(Iterable coll, String separator)
  7. join(Iterable items, String delimiter)
  8. join(Iterable iterable)
  9. join(Iterable parts, String delimiter)