Java集合系列-总体框架

作者:YouChuang
本文主要介绍Java集合的总体架构。



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的方法

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
http://blog.csdn.net/ns_code/article/details/35564663
JDK1.8.8_20

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值