It is equivalent capacity = capacity << 1;.
This operation shifts the power bits one position to the left, which is equivalent to multiplying by 2.
The code you define detects the least power 2, which is greater than initialCapacity.
So, if initialCapacityequal to 27, for example, there capacitywill be 32 (2 ^ 5) after the loop.
source
share