Podcast Lookup

Golang “Set” Data Structure Example

alexkras.com

  • July 8, 2019

About this episode

Golang does not have built it sets. Basic functionality can be mimicked using maps with empty . Another option is to use a Boolean value, but empty struct does not use any space and therefore more efficient. Another benefit of empty struct is that Boolean value can be set to or , which could be confusing in cases where we just want to check for key existence in a set (regardless of it’s…

Source