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

Function ExampleSymmetricDifference

coderd/util/slice/example_test.go:10–21  ·  view source on GitHub ↗

nolint:revive // They want me to error check my Printlns

()

Source from the content-addressed store, hash-verified

8
9//nolint:revive // They want me to error check my Printlns
10func ExampleSymmetricDifference() {
11 // The goal of this function is to find the elements to add & remove from
12 // set 'a' to make it equal to set 'b'.
13 a := []int{1, 2, 5, 6, 6, 6}
14 b := []int{2, 3, 3, 3, 4, 5}
15 add, remove := slice.SymmetricDifference(a, b)
16 fmt.Println("Elements to add:", add)
17 fmt.Println("Elements to remove:", remove)
18 // Output:
19 // Elements to add: [3 4]
20 // Elements to remove: [1 6]
21}

Callers

nothing calls this directly

Calls 1

SymmetricDifferenceFunction · 0.92

Tested by

no test coverage detected