underscore
GitHubToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

Intersection

Intersection computes the list of values that are the intersection of all the slices. Each value in the result is present in each of the slices.

package main


import (
	"fmt"
	u "github.com/rjNemo/underscore"
)

func main(){
    a := []int{1, 3, 5, 7, 9}
    b := []int{2, 3, 5, 8, 0}

    fmt.Println(u.Intersection(a, b)) // {3, 5}
}