Standard library / reflect
reflect.MapIter
Maintains map traversal state. Advance with Next before reading Key or Value; map iteration order is unspecified. Expected stdout: 'true a\n'.
Formal Syntax & Structure
go syntaxgo
type MapIter struct {}Working Example
Example Snippetgo
package main
import ( "fmt" "reflect")
func main() { m := reflect.ValueOf(map[string]int{"a": 7}) var it *reflect.MapIter = m.MapRange() fmt.Println(it.Next(), it.Key().String())}