veda kakarla wrote:......but in HashMap.. we should pass key to get value... how this process is going? i m in confusion, will you please clear it?
In a HashMap, essentially all the keys are stored in a Set. So, the same concept as for Set applies here too. When you ask for a value by giving the key, hashCode() and equals() shall be used to identify the bucket in which the key is in. Once the key is located, the value can be retrieved in no time.