mirror of
https://github.com/thomiceli/opengist.git
synced 2025-02-19 01:55:43 -05:00
13 lines
268 B
Go
13 lines
268 B
Go
package utils
|
|
|
|
func RemoveDuplicates[T string | int](sliceList []T) []T {
|
|
allKeys := make(map[T]bool)
|
|
list := []T{}
|
|
for _, item := range sliceList {
|
|
if _, value := allKeys[item]; !value {
|
|
allKeys[item] = true
|
|
list = append(list, item)
|
|
}
|
|
}
|
|
return list
|
|
}
|