- 博客(7)
- 资源 (2)
- 收藏
- 关注
原创 Java多线程那些事之ConcurrentHashMap
1. HashTable,SynchronizedHashmap,ConcurrentHashmap JDK 1.5之前在多线程环境下,map的实现只有hashtable和synchronized hashmap,因为hashmap本身不是线程安全的。 ConcurrentHashmap不仅仅是线程安全的,而且在性能上优于hashtable和synchronized hashmap
2016-04-18 15:09:41 548
原创 一个例子看明白hashmap
1. 存储对象 以及测试code package com.java.hashmap; public class Country { String name; long population; public Country(String name, long population) { super(); this.name = name; this.population
2016-04-15 15:58:25 4875
转载 HashMap实现原理分析
http://blog.csdn.net/vking_wang/article/details/14166593 1. HashMap的数据结构 数据结构中有数组和链表来实现对数据的存储,但这两者基本上是两个极端。 数组 数组存储区间是连续的,占用内存严重,故空间复杂的很大。但数组的二分查找时间复杂度小,为O(1);数组的特点是:寻址容易,插入和删除
2016-04-15 14:41:25 376
转载 为什么覆写equals的时候一定要覆写hashCode?
http://blog.csdn.net/michaellufhl/article/details/5833188
2016-04-12 15:47:00 490
原创 java多线程那些事之并发集合
When you need to work with data collections in a concurrent program, you must be very careful with the implementation you choose. Most collection classes are not ready to work with concurrent applicat
2016-04-12 14:49:47 496
原创 java多线程那些事之二Cyclincbarrier和countdownlatch
1. CyclicBarrier public class JavaCyclicBarrierExample { public static void main(String[] args) { //3 threads are part of the barrier, ServiceOne, ServiceTwo and this main thread calling th
2016-04-11 15:28:05 605
原创 java多线程那些事之一
1. Callable 接口 获取线程执行状态(get、get(long timeout)),取消线程(cancel(boolean mayinterruptifrunning)),isCancel,isDone等。 1. 实现callable 接口, 2. 创建线程池,submit thread 如下所示: Future processF
2016-04-07 15:58:47 2939
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人