package maps
Import Path
golang.org/x/exp/maps (on go.dev)
Dependency Relation
imports one package, and imported by 5 packages
Involved Source Files
Package maps defines various functions useful with maps of any type.
Package-Level Functions (total 8)
Type Parameters:
M: ~map[K]V
K: comparable
V: any
Clear removes all entries from m, leaving it empty.
Type Parameters:
M: ~map[K]V
K: comparable
V: any
Clone returns a copy of m. This is a shallow clone:
the new keys and values are set using ordinary assignment.
Type Parameters:
M1: ~map[K]V
M2: ~map[K]V
K: comparable
V: any
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.
Type Parameters:
M: ~map[K]V
K: comparable
V: any
DeleteFunc deletes any key/value pairs from m for which del returns true.
Type Parameters:
M1: ~map[K]V
M2: ~map[K]V
K: comparable
V: comparable
Equal reports whether two maps contain the same key/value pairs.
Values are compared using ==.
Type Parameters:
M1: ~map[K]V1
M2: ~map[K]V2
K: comparable
V1: any
V2: any
EqualFunc is like Equal, but compares values using eq.
Keys are still compared with ==.
Type Parameters:
M: ~map[K]V
K: comparable
V: any
Keys returns the keys of the map m.
The keys will be in an indeterminate order.
The simplest true equivalent using the standard library is:
slices.AppendSeq(make([]K, 0, len(m)), maps.Keys(m))
Type Parameters:
M: ~map[K]V
K: comparable
V: any
Values returns the values of the map m.
The values will be in an indeterminate order.
The simplest true equivalent using the standard library is:
slices.AppendSeq(make([]V, 0, len(m)), maps.Values(m))
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |