Does adding a duplicate value to a HashSet/HashMap replace the previous value November 17, 2022 by Tarik In the case of HashMap, it replaces the old value with the new one. In the case of HashSet, the item isn’t inserted.