代码
提交代码
import java.util.List; import java.util.ArrayList; import java.util.Collections; public class Test{ public static void main(String...s){ List<String> collected = new ArrayList<>(); List<String> newArr = new ArrayList<>(); Collections.addAll(newArr,new String[]{"a","b","c"}); for(String string : newArr){ collected.add(string.toUpperCase()); } System.out.println(collected); } }
运行结果