现在文中提到了两种array转list的方法:List.of(T...)、Arrays.asList(T...)
但得到的貌似都是不可变list,无法增删元素
查了下转为可变list的方法,貌似有下面两种
ArrayList<String> list = new ArrayList<String>(Arrays.asList(strArray))
Collections.addAll(arrayList, strArray)
Sign in to make a reply
_small_snail
现在文中提到了两种array转list的方法:List.of(T...)、Arrays.asList(T...)
但得到的貌似都是不可变list,无法增删元素
查了下转为可变list的方法,貌似有下面两种
ArrayList<String> list = new ArrayList<String>(Arrays.asList(strArray))
Collections.addAll(arrayList, strArray)