Set returns a map with the key set to the new value. A nil value is allowed. This function will return a new map even if the updated value is the same as the existing value because Map does not track value equality.
(key K, value V)
| 741 | // This function will return a new map even if the updated value is the same as |
| 742 | // the existing value because Map does not track value equality. |
| 743 | func (m *Map[K, V]) Set(key K, value V) *Map[K, V] { |
| 744 | return m.set(key, value, false) |
| 745 | } |
| 746 | |
| 747 | func (m *Map[K, V]) set(key K, value V, mutable bool) *Map[K, V] { |
| 748 | // Set a hasher on the first value if one does not already exist. |