To check whether an item exists in a HashSet, use the contains() method:

Example

cars.contains("Mazda");



Practice Excercise Practice now