I have two arrays.
One is named foods, it is an array of strings.
The other is named dataList. It is an array of objects that contain an attribute named name.
What I need to do is check if the names in the array foods is present in the dataList. So that means all the items in foods needs to be equal to one of the name attributes in dataList.
I know how to check arrays if both arrays contained the same type of data. But I’m not sure how to do this.
Since we don’t care about the order of the elements nor about the number of times an element is present, we can do this easily with Sets.