func RemoveDuplicateElement(stringList []string) []string {
result := make([]string, 0, len(stringList))
temp := map[string]struct{}{}
for _, item := range stringList {
if _, ok := temp[item]; !ok {
temp[item] = struct{}{}
result = append(result, item)
}
}
return result
}
|
请发表评论