文章目录
一、集合概述
- Collection接口:单列数据
- List接口:元素有序、可重复的集合 “动态数组”
- ArrayList、LinkedList、Vector
// 将数组转换为List
String[] array = { “a”, “b”, “c” };
List list = Arrays.asList(array);
- ArrayList、LinkedList、Vector
- List接口:元素有序、可重复的集合 “动态数组”
// 如果需要一个可变的List,可以这样做
List mutableList = new ArrayList<>(list);
// 将List转换为数组
List list = Arrays.asList(“a”, “b”, “c”);
String[] array = list.toArray(new String[0]);
+ Set接口:元素无序、不可重复的集合 “集合”
+ HashSet(子类:LinkedHashSet)、TreeSet
- Map接口:双列数据
- HashMap、LinkedHashMap、TreeMap、Hashtable、Properties