MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / SliceDistinct

Function SliceDistinct

pkg/util/util.go:215–225  ·  view source on GitHub ↗
(slice []T)

Source from the content-addressed store, hash-verified

213}
214
215func 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
227func RemoveIndex[T any](s []T, index int) []T {
228 if index < 0 || index >= len(s) {

Callers 6

GetProjectMapFunction · 0.92
TestDistinct_EmptyFunction · 0.92

Calls

no outgoing calls

Tested by 3

TestDistinct_EmptyFunction · 0.74