You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
package verify
|
|
|
|
// SliceEq slice相等
|
|
func SliceEq[T comparable](a []T, b []T) bool {
|
|
if len(a) != len(b) {
|
|
return false
|
|
}
|
|
|
|
var m = make(map[T]struct{}, len(a))
|
|
for _, v := range a {
|
|
m[v] = struct{}{}
|
|
}
|
|
|
|
for _, v := range b {
|
|
delete(m, v)
|
|
}
|
|
|
|
return len(m) == 0
|
|
}
|