Popular

How HashMap works in Java? With Animation!! whats new in java8 tutorial

Published on Jul 14, 2015 573,436 views

How does java hashmap work ? HashMap is one of the most popular java.util data structures.
Its one of the associative array implementations, here I have explained its internals in simple terms using an animation. Java8 adds a bit of enhancement to HashMap by using a balanced tree when there is too much has collisions. I have covered that as well.
Please leave your comments if you liked this. Also, subscribe to the channel for updates on similar topics.

Comments
  • Jon KC
    Jon KC 2 года назад Your face is in the way of the slides. lol
  • Javier Frias
    Javier Frias 2 дня назад Great video, this is the best video Ive seen explainig how hashmap works, thanks!!!!
  • Madhu Gali
    Madhu Gali 3 года назад I'd like to add a point to the wonderful explanation of HashMap implementation When HashMap reaches its threshold limit of .75 or 75% it re-size by creating a new array of double the previous size HashMap, and then start putting every old element into that new bucket array and this is called rehashing and it also applies hash function to find new bucket location.
  • Ayushman Srivastava
    Ayushman Srivastava 4 месяца назад this was important part... yet nit covered
  • Chiranjeev Thomas
    Chiranjeev Thomas 7 месяцев назад You're implicitly stating that it's double ... as a previous power of 2 ( 2^4) is being multiplied by 2 .
  • vishal kumar Gupta
    vishal kumar Gupta 8 месяцев назад It does not take double size but size equal to next power of 2.
  • Ayush Jindal
    Ayush Jindal 10 месяцев назад we need to do it so that get and put operations can be done in O(1). if we dont do it, the size of linked lists would keep on increasing and would eventually increase the cost of operations.
  • Satish Patil
    Satish Patil Год назад for any object the index will be 0 to (n-1) when we take mod of (n-1), then why we need to re-index or it re-sizes ???
  • Vinod Kumar
    Vinod Kumar 4 дня назад People who has disliked, what are you guys expecting ? This is just perfect explanation!!
  • Pierry Ângelo Pereira
    Pierry Ângelo Pereira 3 года назад Excellent job @Ranjith ramachandran! Keep doing it!
  • Yuyue Jiang
    Yuyue Jiang 3 года назад This is an in-depth very well explained video! Thanks a lot!
  • Ranjith ramachandran
    Ranjith ramachandran 3 года назад Thanks!
  • Anil sharma
    Anil sharma 3 года назад This is the best tutorial I found for "How HashMap works"! Demo using animation is remarkable :)
  • Flexer
    Flexer 3 недели назад Amazing, thank you for this bro.
  • prakash PK
    prakash PK Неделю назад Simply perfect ! Awesome explanation
  • Shadab
    Shadab 3 года назад Hey Ranjith Very detailed and nicely animated work..It was easy to understand
  • basha chand
    basha chand 3 месяца назад liked, subscribed and i can never forget hashmap implementation for life time now.
  • Harsha Vardhan
    Harsha Vardhan 2 года назад Dude more videos please :) You are awesome :)
  • Manohar Menam
    Manohar Menam 3 года назад One of the best explanation for HashMap. Good work. Keep making more videos.
  • Shyamal Munshi
    Shyamal Munshi 3 года назад This is probably the best explanation of Hashmap I've come across! Kudos to you!
  • Rakesh Gajjar
    Rakesh Gajjar 3 года назад Thanks man! I just learnt something from you! Please keep up the good work.
  • Prajakta Tawale
    Prajakta Tawale 4 месяца назад Its really good explanation...I cleared my doubts and learn a lot from this video. Please add such types of videos in java.. Its really helpful..Thanks a lot Sir
  • НД НД
    НД НД 8 месяцев назад An excellent explanation, thank you truly. However, I think an overall table of algorhytm complexity in HashMap (get, containsKey...) is a must have in this presentation. And, as somebody already stated, threshold limit and re-sizing of HashMap is also very important.
  • Gata Tiberiu Calin
    Gata Tiberiu Calin 3 месяца назад Great explanation on the topic and also great representation. Thank you for this lesson and I am glad to see an Indian with a decent accent!
  • swapnil javanjal
    swapnil javanjal 7 месяцев назад Thanks a ton for all videos. Please keep us the good work. And please upload more videos. I got 3 questions from your video in interview.
  • sudhir kumar
    sudhir kumar 2 года назад thanku plz load all collection video