Fairly short Java 8 solution. Can cope with duplicate keys.
Map map = new HashMap<>();
//fill in map
Set> set = map.entrySet();
Map mapFromSet = set.stream().collect(Collectors.toMap(Entry::getKey,
Entry::getValue,
(a,b)->b));
Edit: thanks to shmosel who deserves more credit than I do for this