1、直接将数组转换为list时List的类型为AbstractList
public static void main(String[] args) {
String[] arr = {"A","B","C","D"};
List<String> list1 = Arrays.asList(arr);
//由数组转化来的list需使用ArrayList再次转换才可使用,否则只能以AbstractList使用
List<String> list = new ArrayList<>(Arrays.asList(arr));
System.out.println("list type:");
System.out.println("list1是否是AbstractList类"+(list1 instanceof AbstractList));
System.out.println("list1是否是AbstractList类"+(list1 instanceof ArrayList));
}
list type:
list1是否是AbstractList类true
list1是否是AbstractList类false
标签:System,arr,list,list1,技术,是否是,一些,零零散散,AbstractList From: https://www.cnblogs.com/LazyLee024/p/16934242.html