Java List to String toStringList(List source)

Here you can find the source of toStringList(List source)

Description

Converts a list of objects to a list of their string equivalents.

License

Mozilla Public License

Parameter

Parameter Description
source The source list.

Return

A list of string equivalents.

Declaration

public static List<String> toStringList(List<?> source) 

Method Source Code

//package com.java2s;
/**//from   w ww .j a v  a 2  s. com
 * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
 * If a copy of the MPL was not distributed with this file, You can obtain one at
 * http://mozilla.org/MPL/2.0/.
 *
 * This Source Code Form is also subject to the terms of the Health-Related Additional
 * Disclaimer of Warranty and Limitation of Liability available at
 * http://www.carewebframework.org/licensing/disclaimer.
 */

import java.util.ArrayList;

import java.util.List;

public class Main {
    /**
     * Converts a list of objects to a list of their string equivalents.
     * 
     * @param source The source list.
     * @return A list of string equivalents.
     */
    public static List<String> toStringList(List<?> source) {
        List<String> dest = new ArrayList<String>(source.size());

        for (Object value : source) {
            dest.add(value.toString());
        }

        return dest;
    }
}

Related

  1. toStringList(final String tags)
  2. toStringList(HashSet V)
  3. toStringList(List list)
  4. toStringList(List list)
  5. toStringList(List list)
  6. toStringList(List intList)
  7. toStringList(List l)
  8. toStringList(List as)
  9. toStringList(Map stringMap, String delim)

  10. HOME | Copyright © www.java2s.com 2016