From 487bbe8f1ed98ce8e186c2d1f9866987d42597de Mon Sep 17 00:00:00 2001 From: b97tsk Date: Tue, 23 Jan 2024 16:22:10 +0800 Subject: [PATCH] Update Set[E].Equal method --- intervalset.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/intervalset.go b/intervalset.go index 5cfe713..a66a7ba 100644 --- a/intervalset.go +++ b/intervalset.go @@ -261,17 +261,7 @@ func (x Set[E]) ContainsRange(lo, hi E) bool { // Equal reports whether x is identical to y. func (x Set[E]) Equal(y Set[E]) bool { - if len(x) != len(y) { - return false - } - - for i := range x { - if !x[i].Equal(y[i]) { - return false - } - } - - return true + return slices.EqualFunc(x, y, Interval[E].Equal) } // Extent returns the smallest Interval that contains every element in x.