HashSet doesn't allow duplicate values. HashMap stores key, value pairs and it does not allow duplicate keys.