2
Data Collections and Functions
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access