// Copyright 2024 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 mapsimport// 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.func [ ~map[], comparable, any]( ) iter.Seq2[, ] {returnfunc( func(, ) bool) {for , := range {if !(, ) {return } } }}// 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.func [ ~map[], comparable, any]( ) iter.Seq[] {returnfunc( func() bool) {for := range {if !() {return } } }}// 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.func [ ~map[], comparable, any]( ) iter.Seq[] {returnfunc( func() bool) {for , := range {if !() {return } } }}// Insert adds the key-value pairs from seq to m.// If a key in seq already exists in m, its value will be overwritten.func [ ~map[], comparable, any]( , iter.Seq2[, ]) {for , := range { [] = }}// Collect collects key-value pairs from seq into a new map// and returns it.func [ comparable, any]( iter.Seq2[, ]) map[] { := make(map[])Insert(, )return}
The pages are generated with Goldsv0.7.0-preview. (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.