Neeraj Vij wrote:just for my help. can you please clarify. will map.values return a non null collection even if the map size is zero.
Yes - in this case, it will return a collection of size zero.
Neeraj Vij wrote:i got it that.it can also return true if the key is in the map - with the value null.
This may be a problem with the key. What class is it? Have you defined your own equals() and hashCode() methods for this class? If so, I suggest you show them here. A problem with these can prevent a HashMap from working correctly.