摘要: LinkedHashMap继承了HashMap, 采用了HashMap的散列结构 因此其随机查询速度很快. 同时由于其修改HashMap.Entry, 添加 before/after Entry<K,V>两个元素用于保存最后添加的元素 以保持顺序结构.private transient Entry<K,V> header;public void clear() { super.clear(); header.before = header.after = header; }private static class Entry<K,V> extends Has 阅读全文
posted @ 2012-12-18 18:38 D.Wang 阅读(157) 评论(0) 推荐(0) 编辑
摘要: HashSet说白了其实就是HashMap.Entry[capacity], HashMap.Entry实现的链表 相当于LinkedList.参数loadFactor对其性能有很大影响.capacity: the number of buckets.initialCapacity: Default value is 16, 用于初始化数组的槽位, capacity永远 >= initialCapacity 并且capacity永远为2的n次幂 最大值为1<<30.因为源码已经解释的很清楚了. 1 if (initialCapacity < 0) 2 throw new 阅读全文
posted @ 2012-12-18 17:57 D.Wang 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 使用TreeSet的目的是要获得一个元素唯一并且排序过的元素集合. 默认排序为升序排列 数字-->大写字母-->小写字母通过两种方式让元素比较排序.一. 元素实现Comparable接口二. 向TreeSet构造函数传入一个实现了Comparator的对象注意事项:1. 当向TreeSet中添加元素时 如果Comparable.compareTo(T t)或Comparator.compare(T t)返回值为0时, 该元素被认为是重复元素并且不会被添加成功. TreeSet由TreeMap实现, TreeSet中的元素即为TreeMap的Key, 当向TreeMap添加元素时, 阅读全文
posted @ 2012-12-17 12:27 D.Wang 阅读(171) 评论(0) 推荐(0) 编辑
摘要: What caused this exception?1) Too many threads was created in application.2) JVM configuration limit the thread number.Our coding seems good, we have done some improvementformulti-threads, e.g. using thread pool and make a suitable thread number, so ignore reason 1.It is needed to investigated the e 阅读全文
posted @ 2012-11-21 13:17 D.Wang 阅读(693) 评论(0) 推荐(0) 编辑