Skip to content

Commit d3e90e3

Browse files
committed
intersection variable parameter
1 parent 10a3fed commit d3e90e3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

slice/intersection.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package slice
22

33
// Intersection
44
// Creates an array of unique values that are included in all given arrays. The order and references of result values are determined by the first array.
5-
func Intersection[T comparable](arrays [][]T) (result []T) {
5+
func Intersection[T comparable](arrays ...[]T) (result []T) {
66
if len(arrays) < 2 {
77
return
88
}

slice/intersection_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ func ExampleIntersection() {
99
{3, 2, 1, 5},
1010
}
1111

12-
fmt.Println(Intersection(arrays))
12+
fmt.Println(Intersection(arrays...))
1313
//Output:
1414
//[2 5]
1515
}

0 commit comments

Comments
 (0)