|
12345678910111213141516171819202122232425262728293031323334353637 |
- package zhios_tool_utils
-
- func RemoveDuplicateString(elms []string) []string {
- res := make([]string, 0, len(elms))
- temp := map[string]struct{}{}
- for _, item := range elms {
- if _, ok := temp[item]; !ok {
- temp[item] = struct{}{}
- res = append(res, item)
- }
- }
- return res
- }
-
- func RemoveDuplicateInt(elms []int) []int {
- res := make([]int, 0, len(elms))
- temp := map[int]struct{}{}
- for _, item := range elms {
- if _, ok := temp[item]; !ok {
- temp[item] = struct{}{}
- res = append(res, item)
- }
- }
- return res
- }
-
- func RemoveDuplicateInt64(elms []int64) []int64 {
- res := make([]int64, 0, len(elms))
- temp := map[int64]struct{}{}
- for _, item := range elms {
- if _, ok := temp[item]; !ok {
- temp[item] = struct{}{}
- res = append(res, item)
- }
- }
- return res
- }
|