I would assume this is a redundant check, because in your sql query you only selected encounter roles that are duplicates that means every name entry in the map definitely has a hashset of size 2+