private long calculateCapacity(long minimumCapacity){
  long newCapacity=Math.min(Math.max(capacity,2),minimumCapacity);
  while (newCapacity < Math.min(minimumCapacity,maxCapacity)) {
    newCapacity<<=1;
  }
  return Math.min(newCapacity,maxCapacity);
}

private long calculateCapacity ( long minimumCapacity ) { long newCapacity = Math . min ( Math . max ( capacity , 2 ) , minimumCapacity ) ; while ( newCapacity < Math . min ( minimumCapacity , maxCapacity ) ) { newCapacity <<= 1 ; } return Math . min ( newCapacity , maxCapacity ) ; }
calculates the next capacity that meets the given minimum capacity .
