-
Book Overview & Buying
-
Table Of Contents
Practical Systems Programming in Go
By :
Although arrays and slices are versatile and powerful, they cannot cover all our needs. This is where maps and structures come into play. Maps let you associate keys with values efficiently, and structs allow you to bundle related fields together into a custom type.
Building upon iterators and functional programming patterns, maps provide a handy and fundamental data structure that demonstrates the emphasis on simplicity and performance. Maps serve as the Go built-in associative array type, offering efficient key-value storage with a hash table implementation under the hood. Unlike the sequential nature of slices, maps provide constant-time average-case lookup operations and flexible key types, making them essential for tasks ranging from caching and indexing to building more complex data structures. Under the hood, Go implements maps as hash tables, providing average O(1) time (constant) complexity for insertions, deletions, and lookups. On the other...