What would you expect a get() method on a Set to do?
- Sets are not indexed, so a
get(int index)makes no sense. (Use aListif you want to get elements by index). get(Object obj)would also not make sense, because you’d have the object that you’re trying to get already.- There is already a
contains()method to check if aSetcontains an object. - You can iterate over a
Setif you want to do something with all elements in the set.