PHPz2017-04-18 09:46:05
is the initial length of the array implemented by the underlying hashmap, not the number of elements.
黄舟2017-04-18 09:46:05
Is it the number of HashMap<Object>Objects? Don’t collections have sizes? The capacity is the largest size. Size refers to the number of elements in the collection, which is the number of Objects here. Thinking about it, it shouldn't be bytes or something. Collections store various objects. How can these objects be the same size? Some objects are more than 16 bytes.
伊谢尔伦2017-04-18 09:46:05
The number of entries that can be stored in the Map, because the bottom layer is implemented using an array, so it is the length of the array
高洛峰2017-04-18 09:46:05
The bottom layer of HashMap in Java8 is such an array (Node<K,V>[] table), and the initial capacity (DEFAULT_INITIAL_CAPACITY) is the default length of the tabletable when creating a new HashMap
大家讲道理2017-04-18 09:46:05
The initial capacity of the container will dynamically change with the number of elements in the container.