private int calculateCapacity ( int minimumCapacity ) { int 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 .