HARMAN Interview Question

map vs set. somebody explain if set throws exception if you try to add duplicate entry?