![]() |
VOOZH | about |
The contains() method of the HashSet class in Java is used to check if a specific element is present in the HashSet or not. So, mainly it is used to check if a set contains any particular element.
HashSet:[1, 2, 3] HashSet Contains 2: true HashSet Contains 10: false
boolean contains(Object o)