@jianchao.li.fighter in this line : 'return mp[abbr].count(word) == mp[abbr].size(); ' , aren't we looking to see if the set contains just one word? can't we replace the line with 'return mp[abbr].size() == 1' ?
I think we don't need to contain a set in HashMap, since if we got more than one value corresponds to this key, then this key is just a marker of duplicates. So my suggestion is to replace the value in HashMap by string.
For duplicates, the value would be some special strings like empty string or null.
For others, the value is simply the word that produces this key
Based on the given example, I think the test case is right. But description should be more detailed. Take a look at case isUnique("cane") -> false, it keeps same abbr with cake but the result is false. I seems that if current word has the same abbr with some word in dict, they should be same word.