Skip to content

Commit 699df6a

Browse files
nextzhoudeckarep
authored andcommitted
check cardinality before check subset
1 parent cbaa98b commit 699df6a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

threadunsafe.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ func (set *threadUnsafeSet) Contains(i ...interface{}) bool {
7676

7777
func (set *threadUnsafeSet) IsSubset(other Set) bool {
7878
_ = other.(*threadUnsafeSet)
79+
if set.Cardinality() > other.Cardinality() {
80+
return false
81+
}
7982
for elem := range *set {
8083
if !other.Contains(elem) {
8184
return false

0 commit comments

Comments
 (0)