deckarep / golang-set

A simple, battle-tested and generic set type for the Go language. Trusted by Docker, 1Password, Ethereum and Hashicorp.
Other
4.15k stars 274 forks source link

Add is empty method #133

Closed Jibaru closed 11 months ago

Jibaru commented 11 months ago

A useful way to verify is a set is empty. Instead of using mySet.Cardinality() == 0, we can use mySet.IsEmpty(). Is simplest, but improve readability. Another way that I think to do that was with a helper function, like empty(mySet), but I tried to follow the current object-oriented approach.

This PR should close the issue #132

deckarep commented 11 months ago

Hi @Jibaru - thanks for the contribution! At first glance this looks good to me. Let me give it a closer look and if I don't see any issues I'll merge away.

-deckarep