Java Collection to String toString(Collection strings)

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

Description

Convert a Collection of strings to a line separated list of strings.

License

Open Source License

Parameter

Parameter Description
strings a Collection of strings

Return

the resulting string representation

Declaration

public static String toString(Collection<String> strings) 

Method Source Code

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

import java.util.*;

public class Main {
    /**//from  www .j  a va 2  s. c  om
     * Convert a Collection of strings to a line separated list of strings.
     * @param strings a Collection of strings
     * @return the resulting string representation
     */
    public static String toString(Collection<String> strings) {
        String string = "";

        for (Iterator<String> itr = strings.iterator(); itr.hasNext();) {
            string += itr.next() + "\n";
        }

        return string;
    }
}

Related

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

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