Java Collection to String collectionToString(Object[] objects)

Here you can find the source of collectionToString(Object[] objects)

Description

collection To String

License

Apache License

Declaration

public static String collectionToString(Object[] objects) 

Method Source Code


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

import java.util.List;

public class Main {
    public static String collectionToString(Object[] objects) {
        String s = "";

        for (int i = 0; i < objects.length; i++) {

            s += objects[i].toString();/*from www.  j a  v  a 2 s .  c o m*/

            if (i < objects.length - 1) {
                s += ", ";
            }

        }

        return s;
    }

    public static String collectionToString(List<Object> objects) {
        String s = "";

        for (int i = 0; i < objects.size(); i++) {

            s += objects.get(i).toString();

            if (i < objects.size() - 1) {
                s += ", ";
            }

        }

        return s;
    }
}

Related

  1. collectionToString(final Collection c)
  2. collectionToString(final Collection collection, final String separator)
  3. collectionToString(final Collection elements, final String separator)
  4. collectionToString(final String separator, final Collection coll)
  5. collectionToString(Iterable c)
  6. collectionToString(String prefix, Collection list)
  7. collectionToStringArray(Collection holder)
  8. collectionToStringArray(Collection objs)
  9. collectionToStringArray(List values)