-1

I am looking for internals of hash map.Some exhaustive detailed info about buckets, Node inside it, Map.Entry etc.

I cant find any online stuff which has exhaustive details about this. I tried going thru source of HashMap inside rt.jar but its too complex to handle.

Please suggest where will i be able to find in detail internal working of hash map.

Thanks

Timothy Drisdelle
  • 395
  • 3
  • 5
  • 14
  • The source code for [HashMap can be found at GrepCode](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/HashMap.java). – MT0 Jun 22 '15 at 14:58

2 Answers2

1

to the best of my knowledge, rt.jar does not contain sources. However, OpenJDK is, well, an open source JDK implementation. This thread has the info on browsing its source code

This is the direct link to the class you were asking: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/java/util/HashMap.java The internal documentation is quite extensive.

Community
  • 1
  • 1
Sharon Ben Asher
  • 13,849
  • 5
  • 33
  • 47
  • Thanks for providing the info but i am finding the source code quite hard to understand the internals and data structures internally. Is there any doc available which provides the overview of hash map internals like bucket creation, modification, extension etc. Something which gives detailed insight into hash map, then i can go for full code understanding which will be easier to comprehend then – Timothy Drisdelle Jun 22 '15 at 14:20
  • 1
    Like I said, the source code contains an extensive documentation regarding implementation. Did you try to read it? – Sharon Ben Asher Jun 22 '15 at 14:24
  • starting at line #143 – Sharon Ben Asher Jun 22 '15 at 14:28
0

Download JDK (not JRE) and look for a src.zip file at the root of the installation path. All source code is there.

Audrius Meškauskas
  • 20,936
  • 12
  • 75
  • 93