使用循环队列实现的Deque接口,号称:
-当stack比stack快
-当queue比linkedlist快
Iterator是Fail fast的,在创建时保存tail位置,next时检查tail是否改变,如果改变则exception。
满篇风骚的位操作
-寻找大于numElements的最小二的整次幂:
initialCapacity = numElements;
initialCapacity |= (initialCapacity >>> 1);
initialCapacity |= (initialCapacity >>> 2);
initialCapacity |= (initialCapacity >>> 4);
initialCapacity |= (initialCapacity >>> 8);
initialCapacity |= (initialCapacity >>> 16);
initialCapacity++;
-对二的整次幂取mod
mask = size - 1;
(h + 1) & mask;
原文地址:http://blog.csdn.net/pouloghost/article/details/45168229