你直接 asList 转的集合,你仔细看看能否增删
- List<String> stooges = Arrays.asList("Larry", "Moe", "Curly");
- stooges.remove("Moe");
- System.out.println(stooges);
-
- ArrayList<String> stooges1 = new ArrayList<String>(Arrays.asList("Larry", "Moe", "Curly"));
- stooges1.remove("Moe");
- System.out.println(stooges1);
复制代码
请问这2个代码的区别在哪里 |