Here you can find the source of asStringList(Collection> list)
Parameter | Description |
---|---|
list | The list with elements. |
private static ArrayList<String> asStringList(Collection<?> list)
//package com.java2s; /******************************************************************************* * Copyright (c) 2015 Fraunhofer Institute for Embedded Systems and * Communication Technologies ESK//from w ww . j a va 2 s . c o m * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * This file is part of ERNEST. * * Contributors: * Fraunhofer ESK - initial API and implementation *******************************************************************************/ import java.util.ArrayList; import java.util.Collection; public class Main { /** * Calls toString for each element and adds it to a new list. * * @param list The list with elements. * @return The list with strings. */ private static ArrayList<String> asStringList(Collection<?> list) { ArrayList<String> result = new ArrayList<String>(list.size()); for (Object o : list) { result.add(o.toString()); } return result; } }