Java Collection to String collectionToStringList(Collection c)

Here you can find the source of collectionToStringList(Collection c)

Description

Take a collection, return a list containing the string value of every element in the collection.

License

Apache License

Parameter

Parameter Description
c collection

Return

a stringified list

Declaration

public static List<String> collectionToStringList(Collection c) 

Method Source Code

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

import java.util.*;

public class Main {
    /**/*w ww  .ja  v  a2  s.  c o  m*/
     * Take a collection, return a list containing the string value of every
     * element in the collection.
     *
     * @param c collection
     * @return a stringified list
     */
    public static List<String> collectionToStringList(Collection c) {
        List<String> l = new ArrayList<String>(c.size());
        for (Object o : c) {
            l.add(o.toString());
        }
        return l;
    }
}

Related

  1. collectionToString(Object[] objects)
  2. collectionToString(String prefix, Collection list)
  3. collectionToStringArray(Collection holder)
  4. collectionToStringArray(Collection objs)
  5. collectionToStringArray(List values)
  6. collectionToStringList(Collection c)
  7. collectionToStringList(Collection list, String delimiter)
  8. commaSeparatedList(Collection objects)
  9. commaSeparatedString(List list, boolean quoteStrings)