Here you can find the source of CreateStringList(Collection
Parameter | Description |
---|---|
values | Collection of objects |
public static ArrayList<String> CreateStringList(Collection<String> values)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Collection; import java.util.Collections; public class Main { /** Converts an array of String objects to a list of String objects. *// w ww. ja v a 2 s. c o m * @param values Array of String objects * @return List of String objects */ public static ArrayList<String> CreateStringList(String... values) { ArrayList<String> results = new ArrayList<String>(); if (values.length > 0) Collections.addAll(results, values); return results; } /** Converts a generic collection of objects into a list of String objects. * * @param values Collection of objects * @return List of String objects */ public static ArrayList<String> CreateStringList(Collection<String> values) { ArrayList<String> results = new ArrayList<String>(); for (Object value : values) results.add(String.valueOf(value)); return results; } }