/**
* The default initial capacity - MUST be a power of two.
*/
static final int DEFAULT_INITIAL_CAPACITY = 1 << 4;
The class java.util.Map
has a static
member DEFAULT_INITIAL_CAPACITY
which is assigned a int
value calculated by the bitwise operation 1<<4
which means 16
.
My question is why they assigned the value like this. What is the advantage of assigning the value using a bitwise operator instead of directly assigning an int
value?