4 ms·
Using a map might not be faster as others have pointed out, but it's often more readable. The core library does this in several places. A map[someType]bool make
by jniedrauer 5y ago
Using a map might not be faster as others have pointed out, but it's often more readable. The core library does this in several places. A map[someType]bool makes for nice, readable code:
if haystack[needle] {
- cy_hauser 5y agoThe lack of an ordered map keep me using slices where I'd otherwise reach for a map. This is one of the things I'm looking forward to once generics are in Go.