(slice []T)
| 213 | } |
| 214 | |
| 215 | func SliceDistinct[T comparable](slice []T) []T { |
| 216 | inResult := make(map[T]bool) |
| 217 | var result []T |
| 218 | for _, str := range slice { |
| 219 | if _, ok := inResult[str]; !ok { |
| 220 | inResult[str] = true |
| 221 | result = append(result, str) |
| 222 | } |
| 223 | } |
| 224 | return result |
| 225 | } |
| 226 | |
| 227 | func RemoveIndex[T any](s []T, index int) []T { |
| 228 | if index < 0 || index >= len(s) { |
no outgoing calls