mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: remove duplicates using the symmetric difference function (#14469)
The `SymmetricDifferenceFunc` used to include duplicates, which was incorrect.
This commit is contained in:
@@ -10,8 +10,8 @@ import (
|
||||
func ExampleSymmetricDifference() {
|
||||
// The goal of this function is to find the elements to add & remove from
|
||||
// set 'a' to make it equal to set 'b'.
|
||||
a := []int{1, 2, 5, 6}
|
||||
b := []int{2, 3, 4, 5}
|
||||
a := []int{1, 2, 5, 6, 6, 6}
|
||||
b := []int{2, 3, 3, 3, 4, 5}
|
||||
add, remove := slice.SymmetricDifference(a, b)
|
||||
fmt.Println("Elements to add:", add)
|
||||
fmt.Println("Elements to remove:", remove)
|
||||
|
||||
Reference in New Issue
Block a user