Hello, so the point was to finish the method that converts a map to a set. Initially I tried to initiate a Set and then put the values of the map in the set, like this:
Set<Cat> catSet = new HashSet<>();
catSet = map.values();
However, this would prompt an error that I am trying to put Collections (if I remember correctly) into a Set object. So then, after a bit of research, I saw the following code:
Set<Cat> catSet = new HashSet<>(map.values());
I don't understand the difference between the two types of code. Can someone please explain? Thank you!