Java集合系列-总体框架
2015-06-15 19:21
549 查看
作者:YouChuang
本文主要介绍Java集合的总体架构。
JDK中常用的jar包和对应的库
Java的集合工具包架构图
Collection
List
Set
Map
Iterator
Enumeration
Arrays和Collections
主要是Collection接口和Map接口
The JDK does not provide any direct implementations of this interface: it provides implementations of more specific subinterfaces like Set and List. This interface is typically used to pass collections around and manipulate them where maximum generality is desired.
实现类
LinkedList
ArrayList
Vector
Stack
实现类
HashSet,依赖于HashMap,并由HashMap实现,因为方法的实现都是调用的HashMap的方法
TreeSet,依赖于TreeMap,由TreeMap实现
AbstractMap为抽象类,实现了Map中的大多数API,
HashMap、TreeMap、WeakHashMap继承于AbstractMap
HashTable继承Dictionary,实现Map接口
ListIterator专门遍历List
参考:
http://www.cnblogs.com/skywang12345/p/3308498.html
/article/1333667.html
JDK1.8.8_20
本文主要介绍Java集合的总体架构。
JDK中常用的jar包和对应的库
Java的集合工具包架构图
Collection
List
Set
Map
Iterator
Enumeration
Arrays和Collections
JDK中常用的jar包和对应的库
Java的集合工具包架构图
主要是Collection接口和Map接口
Collection
一个高度抽象的接口The JDK does not provide any direct implementations of this interface: it provides implementations of more specific subinterfaces like Set and List. This interface is typically used to pass collections around and manipulate them where maximum generality is desired.
List
有序队列,索引+元素,索引从0开始实现类
LinkedList
ArrayList
Vector
Stack
Set
不允许有重复元素的集合实现类
HashSet,依赖于HashMap,并由HashMap实现,因为方法的实现都是调用的HashMap的方法
[code]private transient HashMap<E,Object> map; public HashSet() { map = new HashMap<>(); } public int size() { return map.size(); }
TreeSet,依赖于TreeMap,由TreeMap实现
Map
映射接口,K-V键值对AbstractMap为抽象类,实现了Map中的大多数API,
HashMap、TreeMap、WeakHashMap继承于AbstractMap
HashTable继承Dictionary,实现Map接口
Iterator
遍历工具的集合,Collection依赖于Iterator,因为Collection的实现类都要实现Iterator()函数来返回一个Iterator对象ListIterator专门遍历List
Enumeration
遍历集合,只能在HashTable、Vector、Stack中使用Arrays和Collections
操作数组和集合的两个工具类参考:
http://www.cnblogs.com/skywang12345/p/3308498.html
/article/1333667.html
JDK1.8.8_20
相关文章推荐
- Java消息服务(Java Message Service,JMS)
- javaMail发送邮件步骤与实现
- Springmvc+mybatis
- Java类加载器总结
- 【java设计模式】工厂方法模式
- spring mvc绑定对象String转Date解决入参不能是Date的问题
- java spring
- Java中的注解是如何工作的?
- 停止Java线程,小心interrupt()
- java.lang.RuntimeException: Date pattern must be set for column update_time in the schema of component
- Single Number II
- 设计模式-java实现 简单易理解Demo[待续]
- Java线程学习笔记(两) 线程异常处理
- JDK与JRE的区别
- SpringMVC 开发过程问题总结-, 实体关系映射对象属性要用包装类Integer, Long ,Double
- java中sleep与wait的区别
- [JAVA]利用google的barcode4j生成二维码和条形码
- 数字证书中keytool命令使用说明
- Java环境变量的配置以及Java小常识
- java.lang.IndexOutOfBoundsException 错误解决