Pergunta de entrevista da empresa HARMAN

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