Standard library / maps
maps.Values()
Yields values in unspecified order, once per visited entry. Duplicate values are not removed. Expected stdout: '[1 2 2]\n'.
Formal Syntax & Structure
go syntaxgo
func Values[Map ~map[K]V, K comparable, V any](m Map) iter.Seq[V]Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| m | Map | Input map. |
Return Value
iter.Seq[V]
Yields values in unspecified order, once per visited entry. Duplicate values are not removed.
Working Example
Example Snippetgo
package main
import ( "fmt" "maps" "slices")
func main() { fmt.Println(slices.Sorted(maps.Values(map[string]int{"a": 2, "b": 1, "c": 2})))}