So far, we have seen how a Map works internally. In this section, we'll try to create a simple Map and understand how the preceding topics can be implemented. Instead of looking at the whole implementation in a single place, we'll try to understand it chunk by chunk. For the full implementation, please visit this book's GitHub repository.
Implementing HashMap
A template of the HashMap class
Since the implementation is based on hashing, we named it HashMap. There is nothing strict about the naming though. The following is the template code for our HashMap:
class HashMap<K, V> {
private val minCapacity = 1 shl 4
private val maxCapacity = 1 shl 30
private var table: Array<Node<K, V>?>...