集合与数组的区别
- 长度:数组固定,集合可变
- 存储类型:数组可存基本类型、引用类型,集合只能存引用类型
- 同时存储多种类型:数组不能,集合可以
集合分类
集合:分为Collection接口、Map接口。Collection单列集合,Map双列集合。
Collection:分为List接口、Set接口、Queue接口。List:有序,可重复。Set:不可重复。Queue:先进先出
List:分为ArrayList、LinkedList、Vector
Set:分为HashSet、LinkedHashSet、TreeSet
Queue:分为LinkedList、PriorityQueue
Map:分为HashMap、HashTable、ConcurrentHashMap、TreeMap