You can also use set(existing_url_pairs.values()); is there a reason why you used map?