Java Collection to String toString(Collection objects)

Here you can find the source of toString(Collection objects)

Description

to String

License

LGPL

Declaration

public static String toString(Collection objects) 

Method Source Code

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

import java.util.Collection;

public class Main {
    public static String toString(Collection objects) {

        String string = "";

        for (Object object : objects) {

            string = string + object.toString() + ", ";

        }//from ww  w .j ava 2 s .  co  m

        try {

            string = string.substring(0, string.length() - 2);

        } catch (StringIndexOutOfBoundsException sioobe) {

            return "";

        }

        return string;

    }
}

Related

  1. toStr(Collection elements)
  2. toString(Collection c)
  3. toString(Collection c)
  4. toString(Collection c, String start, String separator, String end)
  5. toString(Collection collection, String separator, int fixedLength)
  6. toString(Collection setOfTests)
  7. toString(Collection softwareTags)
  8. toString(Collection collection)
  9. toString(Collection collection, String prefix, String suffix)