Skip to content

Commit 1cc78ef

Browse files
committed
fix: method name
1 parent cfaeb62 commit 1cc78ef

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,13 +1948,13 @@ b := EveryBy([]int{1, 2, 3, 4}, func(x int) bool {
19481948
// true
19491949
```
19501950

1951-
### Equivalent
1951+
### EqualUnordered
19521952

19531953
Returns true if the subset has the same elements and the same number of each element as the collection.
19541954
Unlike slices.Equal(), which returns effected by order, Equivalent does not care about the order of the elements.
19551955

19561956
```go
1957-
b := Equivalent([]int{0, 1, 1, 3, 0, 0}, []int{0, 1, 3, 0, 1, 0})
1957+
b := EqualUnordered([]int{0, 1, 1, 3, 0, 0}, []int{0, 1, 3, 0, 1, 0})
19581958
// true
19591959
```
19601960

intersect.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ func EveryBy[T any](collection []T, predicate func(item T) bool) bool {
4444
return true
4545
}
4646

47-
// Equivalent Returns true if the subset has the same elements and the same number of each element as the collection.
48-
// Unlike slices.Equal(), which returns effected by order, Equivalent does not care about the order of the elements.
49-
func Equivalent[T comparable, Slice ~[]T](collection, subset Slice) bool {
47+
// EqualUnordered returns true if the subset has the same elements and the same number of each element as the collection.
48+
// Unlike slices.Equal(), which returns effected by order, EqualUnordered does not care about the order of the elements.
49+
func EqualUnordered[T comparable, Slice ~[]T](collection, subset Slice) bool {
5050
l := len(collection)
5151
if l != len(subset) {
5252
return false

intersect_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,22 +88,22 @@ func TestEquivalent(t *testing.T) {
8888
t.Parallel()
8989
is := assert.New(t)
9090

91-
result1 := Equivalent([]int{0, 1, 2, 3, 4, 5}, []int{0, 1, 2, 3, 4, 5})
91+
result1 := EqualUnordered([]int{0, 1, 2, 3, 4, 5}, []int{0, 1, 2, 3, 4, 5})
9292
is.True(result1)
9393

94-
result2 := Equivalent([]int{2, 3, 4, 5, 0, 1}, []int{0, 1, 2, 3, 4, 5})
94+
result2 := EqualUnordered([]int{2, 3, 4, 5, 0, 1}, []int{0, 1, 2, 3, 4, 5})
9595
is.True(result2)
9696

97-
result3 := Equivalent([]int{0, 1, 1, 3, 0, 0}, []int{0, 1, 3, 0, 1, 0})
97+
result3 := EqualUnordered([]int{0, 1, 1, 3, 0, 0}, []int{0, 1, 3, 0, 1, 0})
9898
is.True(result3)
9999

100-
result4 := Equivalent([]int{0, 1, 2, 3, 4}, []int{0, 1, 2, 3, 4, 5})
100+
result4 := EqualUnordered([]int{0, 1, 2, 3, 4}, []int{0, 1, 2, 3, 4, 5})
101101
is.False(result4)
102102

103-
result5 := Equivalent([]int{0, 1, 2, 3, 4, 6}, []int{0, 1, 2, 3, 4, 5})
103+
result5 := EqualUnordered([]int{0, 1, 2, 3, 4, 6}, []int{0, 1, 2, 3, 4, 5})
104104
is.False(result5)
105105

106-
result6 := Equivalent([]int{0, 1, 1, 1, 1, 1}, []int{0, 0, 1, 1, 1, 1})
106+
result6 := EqualUnordered([]int{0, 1, 1, 1, 1, 1}, []int{0, 0, 1, 1, 1, 1})
107107
is.False(result6)
108108
}
109109

0 commit comments

Comments
 (0)