HCLTech Interview Question

Java remove duplicates while adding object to set