type mapping … type entry … var maxSlice … // add adds a key-value pair to the mapping. func (h *mapping[K, V]) add(k K, v V) { … } // find returns the value corresponding to the given key. // The second return value is false if there is no value // with that key. func (h *mapping[K, V]) find(k K) (v V, found bool) { … } // eachPair calls f for each pair in the mapping. // If f returns false, pairs returns immediately. func (h *mapping[K, V]) eachPair(f func(k K, v V) bool) { … }