Results 1 to 2 of 2

Thread: Get Method in Hashmap

  1. #1
    Contributing Member
    Join Date
    Sep 2006
    Answers
    962

    Get Method in Hashmap

    Can any one of you please explain me as how get() method works internally in HashMap class?Does it internally call equals() method to compare the key which we pass as a parameter in get()?

    Since it is said that Strings override equals(), they can be used as a key in hashMap, I just wanted to know if get() internally uses equals() to compare the keys to retreive the value.

    -----------------
    suresh


  2. #2
    Junior Member
    Join Date
    Jan 2007
    Answers
    22

    Re: Get Method in Hashmap

    it actually uses both hashCode and equals for find the keys.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact