MCPcopy Index your code
hub / github.com/coder/coder / DifferenceFunc

Function DifferenceFunc

coderd/util/slice/slice.go:214–222  ·  view source on GitHub ↗
(a []T, b []T, equal func(a, b T) bool)

Source from the content-addressed store, hash-verified

212}
213
214func DifferenceFunc[T any](a []T, b []T, equal func(a, b T) bool) []T {
215 tmp := make([]T, 0, len(a))
216 for _, v := range a {
217 if !ContainsCompare(b, v, equal) {
218 tmp = append(tmp, v)
219 }
220 }
221 return tmp
222}
223
224func CountConsecutive[T comparable](needle T, haystack ...T) int {
225 maxLength := 0

Callers 2

SyncOrganizationsMethod · 0.92
SymmetricDifferenceFuncFunction · 0.85

Calls 1

ContainsCompareFunction · 0.85

Tested by

no test coverage detected