Here you can find the source of cloneStringList(List
Parameter | Description |
---|---|
toClone | The list to clone. |
public static List<String> cloneStringList(List<String> toClone)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { /**/*from w w w. j a v a 2 s . co m*/ * Method to clone a specific list. A list of Strings. * * @param toClone * The list to clone. * @return A completly cloned list. */ public static List<String> cloneStringList(List<String> toClone) { List<String> result = new ArrayList<String>(); for (String s : toClone) { result.add(new String(s)); } return result; } }