// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Package maps defines various functions useful with maps of any type.
package maps import // 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)) func [ ~map[], comparable, any]( ) [] { := make([], 0, len()) for := range { = append(, ) } return } // 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)) func [ ~map[], comparable, any]( ) [] { := make([], 0, len()) for , := range { = append(, ) } return } // Equal reports whether two maps contain the same key/value pairs. // Values are compared using ==. // //go:fix inline func [, ~map[], , comparable]( , ) bool { return maps.Equal(, ) } // EqualFunc is like Equal, but compares values using eq. // Keys are still compared with ==. // //go:fix inline func [ ~map[], ~map[], comparable, , any]( , , func(, ) bool) bool { return maps.EqualFunc(, , ) } // Clear removes all entries from m, leaving it empty. // //go:fix inline func [ ~map[], comparable, any]( ) { clear() } // Clone returns a copy of m. This is a shallow clone: // the new keys and values are set using ordinary assignment. // //go:fix inline func [ ~map[], comparable, any]( ) { return maps.Clone() } // 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. // //go:fix inline func [ ~map[], ~map[], comparable, any]( , ) { maps.Copy(, ) } // DeleteFunc deletes any key/value pairs from m for which del returns true. // //go:fix inline func [ ~map[], comparable, any]( , func(, ) bool) { maps.DeleteFunc(, ) }