Exemplo n.º 1
0
 /** Returns ~2x the old capacity if small; ~1.5x otherwise. */
 private int calculateNewCapacity() {
   int oldCapacity = queue.length;
   int newCapacity =
       (oldCapacity < 64) ? (oldCapacity + 1) * 2 : IntMath.checkedMultiply(oldCapacity / 2, 3);
   return capAtMaximumSize(newCapacity, maximumSize);
 }