首页 > 学院 > 开发设计 > 正文

持有对象(容器)

2019-11-06 06:56:38
字体:
来源:转载
供稿:网友

持有对象

基本概念

数组ListSetQueueMap

数组

容量不能改变

List

ArrayList

基于数组,大量随机访问优选

LinkedList

基于链表,适合经常改动 可用于队列,栈,双向队列

Set

HashSet

提供最快的查询速度LinkedHashSet,以插入顺序保存元素

TreeSet

保持元素处于排序状态

Map

HashMap

用来快速访问,通过散列LinkedHashMap,保持元素插入顺序

TreeMap

保持”键”始终处于排序状态

Queue

LinkedList

Queue<String> q = new LinkedList<>();

PRiorityQueue(优先队列)

PriorityQueue<String> q = new PriorityQueue<>();
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表