Here you can find the source of toString(Collection
Parameter | Description |
---|---|
T | a parameter |
collection | a parameter |
public static <T> Collection<String> toString(Collection<T> collection)
//package com.java2s; import java.util.ArrayList; import java.util.Collection; public class Main { /**/*from www . j av a 2 s.c o m*/ * Returns a String representation of the input collection by calling each * element's toString() method. * * @param <T> * @param collection * @return */ public static <T> Collection<String> toString(Collection<T> collection) { Collection<String> strings = new ArrayList<String>(); for (T item : collection) strings.add(item.toString()); return strings; } }