Collection框架

1 常见接口和类

Collection框架

其中,矩形为接口,椭圆为类。

2 接口设计理由

比较显然的理由有:

1 元素是否可重复。分为List和Set。按此原则,Queue应该实现List。

2 能否随机访问,List分为ArrayList和LinkedList。

3 按无素是否有序。Set分为HashSet和SortedSet。

按是否线程安全。ArrayList -> Vector,Queue -> BlockingQueue,Deque -> BlockingDeque,

你可能感兴趣的:(Collection)