August 2018
Intermediate to advanced
524 pages
14h 45m
English
HashMap is a hash table-based implementation of the Map interface. Because the implementation uses a hash table, the get() and put() methods usually perform very fast, constant, and time-independent of the actual number of elements in the map. If the map size grows and the number of table elements is not enough to store the elements ergonomically, putting a new element into this type of map may force the implementation to resize the underlying array. In this case, each element that is already in the array has to be placed again in the new, increased size array. In those cases, the put() operation may consume significant time, proportional to the number of elements in the map.
When an element is to be stored in this map, then hashCode() ...