I need to create a method that will compare two sets of integers and return a new set of integers that represent all matching numbers.
I am using a Random number generator that will for example generate 6 numbers eg.[12,33,28,17,45, 32].
In my console while using Scanner Class I will type in 6 numbers e.g. [32,5,11,12,43,1].
I need my method to return all matching numbers which in this case would be [12,32]
I want to use a set to achieve this. This is what I have so far.
public Set<Integer> playNumbers (Set<Integer> GenNumbers, Set<Integer> myNumbers)
{
return null;
}
GenNumbers the lottery numbers that were randomly generated. myNumbers my picked numbers that were typed in the console. return as set of matched numbers.
Not sure how to proceed with this.