Organizational Research By

Surprising Reserch Topic

hashmap implementation in java how does the bucket index calculation work using -'java,hashmap'


hashmap implementation in java how does the bucket index calculation work  using -'java,hashmap'

I am looking at the implementation of HashMap in Java and am stuck at one point.
How is the indexFor function calculated?

static int indexFor(int h, int length) {
   return h & (length-1);
}


Thanks
    

asked Sep 7, 2015 by rajesh
0 votes
11 views



Related Hot Questions

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

...