Java Collection to String toString(Collection objects, CharSequence delimiter)

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

Description

to String

License

Open Source License

Declaration

public static String toString(Collection<?> objects,
            CharSequence delimiter) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;

public class Main {
    public static String toString(Collection<?> objects,
            CharSequence delimiter) {
        StringBuilder sb = new StringBuilder();
        for (Object o : objects) {
            sb.append(o.toString());/*www.  j  a v  a 2 s  .c  o m*/
            sb.append(delimiter);
        }
        sb.setLength(sb.length() - delimiter.length());
        return sb.toString();
    }
}

Related

  1. toString(Collection collection)
  2. toString(Collection collection)
  3. toString(Collection collection, String separator)
  4. toString(Collection elements, String separator)
  5. toString(Collection itemList)
  6. toString(Collection bytes, Collection result)
  7. toString(Collection collection)
  8. toString(Collection strings)
  9. toString(Collection a, String begStr, String sepStr, String endStr)

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