Java Iterable to String toString(Iterable strs)

Here you can find the source of toString(Iterable strs)

Description

to String

License

Open Source License

Declaration

public static String toString(Iterable<String> strs) 

Method Source Code

//package com.java2s;

import java.util.Iterator;

public class Main {
    public static String toString(Iterable<String> strs) {

        StringBuilder ret = new StringBuilder();
        for (Iterator<String> i = strs.iterator(); i.hasNext();) {
            ret.append(i.next());/*from  ww w. j  a  v a2  s  .co  m*/
            if (i.hasNext())
                ret.append(",");
        }
        return ret.toString();
    }
}

Related

  1. toString(Iterable c, String delim, String prefix, String suffix)
  2. toString(Iterable objects, String sep)
  3. toString(Iterable it, String separator)
  4. toString(Iterable names)
  5. toString(Iterable iterable)
  6. toString(Iterable iterable, String separator)