Skip to content

Commit b64983a

Browse files
authored
Update intersect.go
1 parent 2a222db commit b64983a

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

intersect.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,20 +226,16 @@ func WithoutNth[T comparable, Slice ~[]T](collection Slice, nths ...int) Slice {
226226
return result
227227
}
228228

229-
// ElementsMatch returns true if lists
230-
// contain the same set of elements (including empty set).
231-
//
232-
// If there are duplicate elements,
233-
// the number of appearances of each of them in both lists should match.
229+
// ElementsMatch returns true if lists contain the same set of elements (including empty set).
230+
// If there are duplicate elements, the number of appearances of each of them in both lists should match.
231+
// The order of elements is not checked.
234232
func ElementsMatch[T comparable, Slice ~[]T](list1 Slice, list2 Slice) bool {
235233
return ElementsMatchBy(list1, list2, func(item T) T { return item })
236234
}
237235

238-
// ElementsMatchBy returns true if lists
239-
// contain the same set of elements' keys (including empty set).
240-
//
241-
// If there are duplicate keys,
242-
// the number of appearances of each of them in both lists should match.
236+
// ElementsMatchBy returns true if lists contain the same set of elements' keys (including empty set).
237+
// If there are duplicate keys, the number of appearances of each of them in both lists should match.
238+
// The order of elements is not checked.
243239
func ElementsMatchBy[T any, K comparable](list1 []T, list2 []T, iteratee func(item T) K) bool {
244240
if len(list1) != len(list2) {
245241
return false

0 commit comments

Comments
 (0)