Skip to content

Commit

Permalink
check cardinality before check subset
Browse files Browse the repository at this point in the history
  • Loading branch information
nextzhou authored and deckarep committed Sep 27, 2018
1 parent cbaa98b commit 699df6a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions threadunsafe.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ func (set *threadUnsafeSet) Contains(i ...interface{}) bool {

func (set *threadUnsafeSet) IsSubset(other Set) bool {
_ = other.(*threadUnsafeSet)
if set.Cardinality() > other.Cardinality() {
return false
}
for elem := range *set {
if !other.Contains(elem) {
return false
Expand Down

0 comments on commit 699df6a

Please sign in to comment.