摘要: [TOC] 概述   为了对共享资源提供更细粒度的同步控制,JDK5新增了java.util.concurrent(JUC)并发工具包,并发包新增了Lock接口(以及相关实现类)用来实现锁功能,它提供了与synchronized关键字相似的同步功能,只是在使用时需要显式地获取和释 阅读全文
posted @ 2018-12-03 16:22 默数至天亮 阅读(522) 评论(0) 推荐(1) 编辑
摘要: [TOC] 多线程的概念 什么是多线程   操作系统在运行程序时,就会为其创建一个进程,我们可以把进程理解为“运行中的程序”,它拥有独立的地址空间,包括文本区域(text region)、数据区域(data region)和堆栈(stack region);而一个进程又能够创建多 阅读全文
posted @ 2018-11-29 16:22 默数至天亮 阅读(477) 评论(0) 推荐(0) 编辑
摘要: [TOC] HashSet概述   从前面开始,已经分析过集合中的List和Map,今天来介绍另一种集合元素:Set。这是JDK对HashSet的介绍: This class implements the Set interface, backed by a hash table 阅读全文
posted @ 2018-11-01 22:52 默数至天亮 阅读(143) 评论(0) 推荐(0) 编辑
摘要: [TOC] LinkedHashMap概述   JDK对LinkedHashMap的介绍: Hash table and linked list implementation of the Map interface, with predictable iteration ord 阅读全文
posted @ 2018-09-21 09:08 默数至天亮 阅读(510) 评论(0) 推荐(0) 编辑
摘要: [TOC] 概述   在 "上文" 我们基于JDK7分析了HashMap的实现源码,介绍了HashMap的加载因子loadFactor、阈值threshold概念以及增删元素的机制。JDK8在JDK7的基础上对HashMap的实现进行了进一步的优化,最主要的改变就是新增了红黑树作 阅读全文
posted @ 2018-08-26 10:53 默数至天亮 阅读(671) 评论(0) 推荐(2) 编辑
摘要: [TOC] HashMap概述   前面我们分析了基于数组实现的ArrayList和基于双向链表实现的LinkedList,它们各有优缺点:ArrayList查找元素快但是插入删除元素慢,LinkedList插入删除元素快但是查找元素慢。那么有没有一种数据对象能够做到高效的查询和 阅读全文
posted @ 2018-07-28 08:54 默数至天亮 阅读(645) 评论(0) 推荐(0) 编辑
摘要: [TOC] LinkedList   JDK api对LinkedList的介绍: Doubly linked list implementation of the List and Deque interfaces. Implements all optional list o 阅读全文
posted @ 2018-07-18 10:43 默数至天亮 阅读(575) 评论(2) 推荐(0) 编辑
摘要: [TOC] ArrayList分析   JDK api对ArrayList是这样介绍的: Resizable array implementation of the List interface. Implements all optional list operations, 阅读全文
posted @ 2018-07-07 16:00 默数至天亮 阅读(294) 评论(0) 推荐(0) 编辑