All packages

maps

import "maps"

Package maps defines various functions useful with maps of any type. This package does not have any special handling for non-reflexive keys (keys k where k != k), such as floating-point NaNs.

Go 1.26.1

Functions

func All(m Map) interface{}

All returns an iterator over key-value pairs from m. The iteration order is not specified and is not guaranteed to be the same from one call to the next.

maps/iter.go:12

func Clone(m M) M

Clone returns a copy of m. This is a shallow clone: the new keys and values are set using ordinary assignment.

maps/maps.go:50

func Collect(seq interface{}) map[K]V

Collect collects key-value pairs from seq into a new map and returns it.

maps/iter.go:58

func Copy(dst M1, src M2)

Copy copies all key/value pairs in src adding them to dst. When a key in src is already present in dst, the value in dst will be overwritten by the value associated with the key in src.

maps/maps.go:62

func DeleteFunc(m M, del func(...))

DeleteFunc deletes any key/value pairs from m for which del returns true.

maps/maps.go:69

func Equal(m1 M1, m2 M2) bool

Equal reports whether two maps contain the same key/value pairs. Values are compared using ==.

maps/maps.go:17

func EqualFunc(m1 M1, m2 M2, eq func(...)) bool

EqualFunc is like Equal, but compares values using eq. Keys are still compared with ==.

maps/maps.go:31

func Insert(m Map, seq interface{})

Insert adds the key-value pairs from seq to m. If a key in seq already exists in m, its value will be overwritten.

maps/iter.go:50

func Keys(m Map) interface{}

Keys returns an iterator over keys in m. The iteration order is not specified and is not guaranteed to be the same from one call to the next.

maps/iter.go:25

func Values(m Map) interface{}

Values returns an iterator over values in m. The iteration order is not specified and is not guaranteed to be the same from one call to the next.

maps/iter.go:38