when to use:
当不知道程序运行时会需要多少对象,或者需要以更复杂的形式来储存对象时,可以使用java集合框架。(e.g. 假定学员数)
- 接口(4个:Collection\ List\ Set \ Map)
: (1)Collection单值
: List : ArrayList\ LinkedList (子类实现)
: Set : HashSet \ TreeSet
: (2)Map : 键-值对形式(key-value)
: HashMap
: TreeMap
工具类Collections提供了对集合进行排序、遍历等多种算法实现 - 具体类
- 算法
- Vector(也是List接口的一个子类实现,数据结构也为数组)同ArrayList的区别:
(1)