var array1 = ["Duck", "Dog", "Cat", "Bird", "Elephant", "Cow", "Goat", "Goose"]
var array2 = ["Eagle", "Giraffe", "Cow", "Elephant", "Sheep", "Penguin", "Rhinoceros"]

print( Set(array1).intersection(array2) //-> [Elephant, Cow]
print( Set(array1).intersection(array2).count ) //-> 2

+ Recent posts