Here you can find the source of asStringArray(Collection extends Object> coll)
Parameter | Description |
---|---|
coll | a parameter |
public static String[] asStringArray(Collection<? extends Object> coll)
//package com.java2s; /*/* ww w.j a v a 2 s. c o m*/ * Copyright (c) Ludger Solbach. All rights reserved. * The use and distribution terms for this software are covered by the * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) * which can be found in the file license.txt at the root of this distribution. * By using this software in any fashion, you are agreeing to be bound by * the terms of this license. * You must not remove this notice, or any other, from this software. */ import java.util.Collection; public class Main { /** * Convert the collection to a string array. The method toString() is called on every entry. * @param coll * @return string array */ public static String[] asStringArray(Collection<? extends Object> coll) { int i = 0; String[] strings = new String[coll.size()]; for (Object o : coll) { strings[i++] = o.toString(); } return strings; } }