Use the isEmpty() method to check if a HashSet is empty.
The isEmpty() method returns true if the HashSet contains no elements. This is useful for checks before operations that assume a non-empty collection, like processing a batch of product updates.