方式1:
package _test; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.apache.commons.collections.CollectionUtils; public class Test_Java { public static void main(String[] args) { List<Integer> list = new ArrayList<>(); for (int i = 0; i < 10; i++) { list.add(i); } List<Integer> copyList = new ArrayList<>(); CollectionUtils.addAll(copyList, new Object[list.size()]); Collections.copy(copyList, list); copyList.add(10); System.out.println("原值:"+list); System.out.println("copy值:"+copyList); } }