Originally posted by Jaideep Kshirsagar:
How you will write a function for reversing the character array? If you are using two arrays for this function, how you will go about optimizing the code and memory requirement by using only one array?
Can there be multiple same keys in hash map? How to sort and search on the basis of keys in hash map? What is hash code and how it is used?
The first line in the API documentation of java.util.Map:
An object that maps keys to values. A map cannot contain duplicate keys; each key can map to at most one value.
This is the same with maps in all languages I know. I mean, what's the use of a map when you can't get the value for a key? If you have multiple values for one key, which one do you return?
Should you need to have multiple values for a key, use a collection (e.g. List) as the value.
[ September 21, 2007: Message edited by: Rob Prime ]