List of utility methods to do Collection to List
List | newList(final Collection new List return array(objects);
|
String | toList(Collection addresses, char separator) Format all strings in the collection by using the specified separator. StringBuffer buf = new StringBuffer(); for (Iterator itr = addresses.iterator(); itr.hasNext();) { String address = (String) itr.next(); if (buf.length() > 0) buf.append(separator); buf.append(address); return buf.toString(); ... |
List | toList(Collection collection) Converts the given collection to a java.util.List .
if (collection instanceof List) return (List) collection; List list = new ArrayList(); Iterator iterator = collection.iterator(); while (iterator.hasNext()) { list.add(iterator.next()); return list; ... |
List | toList(Collection> collection) Creates list from array/set of elements int size = (collection == null) ? 0 : collection.size(); List<Object> result = new ArrayList<Object>(size); if (collection != null) result.addAll(collection); return result; |
List | toList(Collection to List if (c instanceof List) return (List<E>) c; ArrayList<E> o = new ArrayList<E>(c.size()); for (E e : c) o.add(e); return o; |
List | toList(Collection to List if (collection == null) return null; if (collection instanceof List) { return (List<E>) collection; } else { return new ArrayList<E>(collection); |
List | toList(Collection to List List<String> list = new ArrayList<String>(lines.size()); for (String line : lines) { list.add(line); return list; |
List | toList(Collection to List return Collections.list(Collections.enumeration(c));
|
List | toList(Collection to List return asList(c);
|
List | toList(Collection Converts a collection to a list, either by casting or by explicit conversion. return collection instanceof List ? (List<T>) collection : new ArrayList<T>(collection); |