SetEquals determines whether two string sets are identical.
(a []string, b []string)
| 151 | |
| 152 | // SetEquals determines whether two string sets are identical. |
| 153 | func SetEquals(a []string, b []string) bool { |
| 154 | if len(a) != len(b) { |
| 155 | return false |
| 156 | } |
| 157 | |
| 158 | sort.Strings(a) |
| 159 | sort.Strings(b) |
| 160 | |
| 161 | for i, v := range a { |
| 162 | if v != b[i] { |
| 163 | return false |
| 164 | } |
| 165 | } |
| 166 | return true |
| 167 | } |
| 168 | |
| 169 | // SetEquals determines whether two int sets are identical. |
| 170 | func SetEqualsInt(a []int, b []int) bool { |
searching dependent graphs…