santhosh.R gowda wrote:How to remove duplicate values in hash map.... as we know we can apply logic and do but i want to use API methods and remove
You cannot have multiple entries with the same key: calling put(someKey, someValue) and then put(someKey, someOtherValue) will overwrite the someKey - someValue pair.
To check the presence of a value, you have Map.containsValue(Object value), but it may not be efficient. You may be better off using 2 Maps, one for key - value, one for value - key pairs, or add/remove values to a (Hash)Set and call setForValues.contains(value) instead of map.containsValue(value). You may need to synchronize these operations to make sure your data is consistent at all times.
I would recommend Google Collections' BiMap instead. If only because generics have been with us for some time now, and it's annoying to deal with a library that can't handle them. And in general I find Google Collections better-engineered than most of the Apache Commons stuff I've seen. Though I haven't compared BidiMap and BiMap too carefully.