SameElements returns true if the 2 lists have the same elements in any order.
(a []T, b []T)
| 58 | // SameElements returns true if the 2 lists have the same elements in any |
| 59 | // order. |
| 60 | func SameElements[T comparable](a []T, b []T) bool { |
| 61 | if len(a) != len(b) { |
| 62 | return false |
| 63 | } |
| 64 | |
| 65 | for _, element := range a { |
| 66 | if !Contains(b, element) { |
| 67 | return false |
| 68 | } |
| 69 | } |
| 70 | return true |
| 71 | } |
| 72 | |
| 73 | func ContainsCompare[T any](haystack []T, needle T, equal func(a, b T) bool) bool { |
| 74 | for _, hay := range haystack { |