Thanks to generics, there are some interesting new ways to program in Go. This article explains how we can use functional programming techniques like Map, Filter, and Reduce, and what kind of problems they might help us to solve.
All tagged map
Thanks to generics, there are some interesting new ways to program in Go. This article explains how we can use functional programming techniques like Map, Filter, and Reduce, and what kind of problems they might help us to solve.
What is a map in Golang and how does it work? Are Go maps thread-safe? Are maps pointers? How do you check if a map is empty? Can maps be nil? Go teacher and expert John Arundel answers these and other questions about Go maps.
What is a map[string]interface{} or map[string]any in Go, and why is it so useful? How do we deal with maps of string to interface{} in our programs? What the heck is an interface{}, anyway?
How do you iterate over Golang maps? How do you print a map? How do you write a for loop that executes for each key and value in a map? What is the iteration order of Go maps? Let's find out, in this practical, easy-to-follow tutorial.
What happens if you look up a key in a Go map that doesn’t exist? How do you check if a key is present in a map? How do you represent a set of objects as a map in Golang, and efficiently check whether a given value is in the set?
More about Golang maps: looking up keys, adding and updating values, and how to update the fields of a struct within a map. This mini-tutorial is part of a series on everything you need to know about maps in Go!
What map types exist in Go? What data types can we use as map keys? What about map values? Are different kinds of maps considered distinct types? And what’s the difference between nil and empty maps? Find out in this handy, bite-size tutorial on map types in Golang.
What is a Golang map? Why is it useful? How does it compare to a slice? How do you declare a map? How do you initialize a map in Go? Fear not, all these questions are answered in this friendly introduction to one of Go’s most powerful features.