mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
22 lines
400 B
Go
22 lines
400 B
Go
// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
package utils
|
|
|
|
func StringArrayIntersection(arr1, arr2 []string) []string {
|
|
arrMap := map[string]bool{}
|
|
result := []string{}
|
|
|
|
for _, value := range arr1 {
|
|
arrMap[value] = true
|
|
}
|
|
|
|
for _, value := range arr2 {
|
|
if arrMap[value] {
|
|
result = append(result, value)
|
|
}
|
|
}
|
|
|
|
return result
|
|
}
|