01. Internal Working of HashMap & Java-8 Enhancement

Поделиться
HTML-код
  • Опубликовано: 1 окт 2024
  • #java #interviewquestions #webencyclop
    In this playlist I will try to cover all the important java interview questions along with answers in very intuitive, kind of pictorial/animated way.
    Complete Playlist:
    • Java Developer Intervi...
    Next Video:
    • 02. Equals and HashCod...
    Video includes:
    - 00:16 What is internal memory structure of HashMap?
    - 04:09 How HashMap "Map.put()" method works?
    - 06:41 What is a Hash Collision?
    - 08:37 What is the use of Object.equals() method in HashMap.
    - 09:03 Summary of internal working of Map.put() method in HashMap.
    - 10:35 How to search element in LinkedList
    - 12:03 How HashMap "Map.get()" method internally works.
    - 14:30 Why we need enhancement in Java 8 HashMap, what was the problem before?
    - 15:03 Java 8 enhancement in HashMap, (storing elements from LinkedList into Tree structure)
    - 15:15 What is treefy threshold in HashMap ?
    - 18:08 What is red-black Tree in HashMap. Binary Search Tree or Self Balancing Tree.
    In this series we will be covering all Java interview questions and answers. This is going to be comprehensive list of Java interview questions which can help experienced Java developers to prepare for an interview as well as upskilling the Java knowledge.
    I would always recommend everyone to watch Durga Sir (durgasoft) videos because of extensive in depth explaination on all topics if you have more time.
    But here we will try to cover important aspects of Java Programming which are always asked in interviews withing less time.
    We will be covering below topics in the video.
    1. Hashmap Interview Questions
    2. Hashmap Java 8
    3. Hashmap Java Coding interviews
    4. Hashmap in Java by Durga
    5. Hashmap Java Interview Questions
    6. HashMap internal working
    7. equals-hashcode
    8. get method
    9. hashmap in java
    10. internal-working-hashmap
    11. interview-questions
    12. java 8
    13. java tutorial
    14. java-8-nehancement
    15. put method
    16. job interview questions and answers
    17. behavioral interview questions and answers
    18. job interview tips
    19. Interview questions and answers
    20. Animated java
    21. java animation
    22. java programming tutorial
    23. Hashmap java 8
    24. learn java
    25. java tutorial for beginners
    26. Hashmap enhancements in Java 8

Комментарии • 217

  • @evgenii550
    @evgenii550 Год назад +11

    you said that the capacity will be increased if 12 buckets will be full (for initial capacity = 16), but if i try to use class, which hashCode() always returns 1, as a key, then all the new pairs will be stored in one bucket with index 1 and according to debugging the capacity will still be increased. doesn't this mean that the load factor depends on the number of pairs in the hash map? not on the number of buckets with pairs

    • @ankit.wasankar
      @ankit.wasankar  Год назад +2

      ah good catch, let me pin 📌 this post. thanks for your comment.

    • @cyberulitka4661
      @cyberulitka4661 Год назад +1

      thank you for your comment! good point!

    • @ukj6795
      @ukj6795 9 месяцев назад +2

      nice observation, thanks for sharing this

    • @dhanashreekamali3185
      @dhanashreekamali3185 6 месяцев назад

      Is loadfactor depending on number of entries in Hashmap? @webencyclop (if not what is the meaning of pairs here? what does this pair signify?)

    • @pratikbhange2757
      @pratikbhange2757 6 месяцев назад

      ​@@dhanashreekamali3185key and value😊

  • @aniketbharsakale2561
    @aniketbharsakale2561 3 года назад +45

    Your pictorial representations, the images & the color that's choosen for slides, the way you have explained it so neatly, its commendable. You have simplified a tough concept and making complex things look simple is an art. Great job. Good going!

  • @aniruddhachunne3011
    @aniruddhachunne3011 2 года назад +2

    Superb.... you are the best.... god bless you

  • @PrivateMovie
    @PrivateMovie 4 месяца назад +3

    🎯 Key Takeaways for quick navigation:
    00:00 *Interview question introduction*
    00:13 *Creating new jobs*
    01:10 *Subscribe for updates*
    02:22 *Journey components*
    03:49 *Multiple nodes concept*
    05:09 *Hash code importance*
    06:47 *Calculating values*
    08:51 *Node equality check*
    10:35 *Item searching process*
    12:29 *Time complexity overview*
    14:13 *Notification system*
    15:11 *Tree conversion process*
    16:04 *Web content benefits*
    16:28 *Tree structure benefits*
    16:52 *Search optimization method*
    17:23 *String comparison methods*
    17:58 *Red-black tree definition*
    18:11 *Binary search tree*
    18:29 *Tree conversion process*
    18:49 *Future interview questions*
    Made with HARPA AI

  • @kishyash1
    @kishyash1 2 года назад +2

    if hashmap size reaches above load factor i.e(3/4) of initial size than it will double the size of hashmap in such case it will rearrange key or not because size of hashmap is increased.please clarify on this point

    • @ankit.wasankar
      @ankit.wasankar  2 года назад

      Yes, ,it will do re arrangment. It's an expensive operation.. This process also called as rehashing.

  • @ganeshdhareshwar6053
    @ganeshdhareshwar6053 2 года назад +1

    Nice explanation. But only request is, don't repeat "ok" everytime.

  • @dileepmidasala9754
    @dileepmidasala9754 Месяц назад +2

    Hashmap bucket intex start from 0 to 15 . But you mentioned 1 t 16

  • @yusufsaifi3108
    @yusufsaifi3108 3 года назад +1

    Plz make full collection type video ur way of represente slide in pictorial way is wonder full .keep it up......

  • @Shaanku
    @Shaanku 2 года назад +1

    Thanks for the explanation. It was very helpful

  • @ahir_shubham
    @ahir_shubham 3 года назад +4

    Beautiful explanation with specially the images...felt very comfortable to understand...Keep going...Thankyou!

  • @AkhileshKumar-li6me
    @AkhileshKumar-li6me 8 месяцев назад +4

    Kindly note that when hashmap is passed the duplicate key, it calls the hashCode() method to generate the hash value for the key and this hash value helps in determining where to put this new entry but since this index/position already has one entry. Since each bucket stores the entry/ies in the form of a linked list so new entry will be added at the top/right end of the linked list. The same logic will be applied if another duplicate key arrives. Please note, when we try to retrieve the value by passing the key(which is duplicate in nature), hashmap goes to the appropriate index by calculating the hash value and traverses the linked list, and returns the most recent value as all the keys are same.

  • @resh9906
    @resh9906 2 года назад +1

    Best explanation for hashmap. Thanks!

  • @yogeshpawarvlogs527
    @yogeshpawarvlogs527 3 года назад +16

    The way he represents the data is phenomenal...
    Thums up for his presentation. 👍👍👍

  • @nandanpatil299
    @nandanpatil299 2 года назад +2

    Best Representation, Really helpful, request to you please create video on "Internal working of HashSet"...

  • @koushikdas2755
    @koushikdas2755 2 года назад +1

    Just awesome.....Thanks you sir!

  • @ektayoga
    @ektayoga 3 года назад +1

    Thank you sir. You are excellent.

  • @haihellonamastey
    @haihellonamastey 2 года назад +1

    crystal clear explaination👌👌👌

  • @monaliparihar5138
    @monaliparihar5138 2 года назад +1

    One of the best tutorial …. Thank you

  • @manishpatidar5379
    @manishpatidar5379 3 года назад +4

    Picturial representation makes this videos excellent... It will be easy to remember the flow chart

  • @nitincareer9190
    @nitincareer9190 3 года назад +4

    Excellent video on Hashmap so far, keep doing more like this.

  • @VishalRaj-wu8il
    @VishalRaj-wu8il 7 месяцев назад +2

    best video on HashMap internal working and loved your content.thank you for such great content.😊

  • @gudesreekanth6373
    @gudesreekanth6373 3 года назад +2

    Best explanation so far in youtube on hashmap internal working... Nice buddy!! Appreciate your effort ...

  • @IZZY3201
    @IZZY3201 3 года назад +1

    Amazing explanation👍👍

  • @rameshnallajarla5697
    @rameshnallajarla5697 2 года назад +1

    very good explanation.

  • @sharanyabhiram3601
    @sharanyabhiram3601 3 месяца назад +2

    Hey your core java interview series is very helpful.. I wish you continue doing many more topics in this.

  • @mit1696
    @mit1696 2 года назад +1

    Awesome Explanation

  • @janakinaidu_studios9027
    @janakinaidu_studios9027 3 года назад +1

    Awesome Explanation

  • @shyamvittal
    @shyamvittal 2 года назад +1

    One word... "AWESOME"

  • @ravirajpradhan4720
    @ravirajpradhan4720 2 года назад +1

    All is best ....very nice

  • @parambharti7095
    @parambharti7095 3 года назад +2

    Great explanations. Thanks !! Please keep making more videos. Nice way of teaching.

  • @tunghoang9373
    @tunghoang9373 3 года назад +1

    Thanks from a user from Viet Nam
    Your explanation was so easy to understand although it's hard to understand your english as much :)

  • @pratikjagadale3216
    @pratikjagadale3216 3 года назад +2

    Tried a lot on the internet to understand hashmap working ... finally brother understood from your video👍👍👍

  • @subhaneilsengupta3053
    @subhaneilsengupta3053 2 года назад +1

    Excellent explanation.

  • @milimishra6447
    @milimishra6447 3 года назад +1

    best explaination ❤❤❤

  • @RaviKumar-vk6ib
    @RaviKumar-vk6ib 2 года назад +1

    10:38 java 8 enhancement

  • @prashanthkumar-jj3dq
    @prashanthkumar-jj3dq 3 года назад +1

    Excellent explanation

  • @dipaliyadav-koli1060
    @dipaliyadav-koli1060 3 года назад +1

    Thank you so much..

  • @nagarjunreddy1040
    @nagarjunreddy1040 2 года назад +1

    Very nice, love it

  • @Veronica-vq5iz
    @Veronica-vq5iz 2 года назад +2

    Wow, you explained it so well, I have watched so many tutorials for this concept and never had this deep understanding. Thank u so much.

  • @yogeshchanekar6263
    @yogeshchanekar6263 2 года назад +1

    Mast Bhawa

  • @venki1437
    @venki1437 2 года назад +1

    Hi sir ,The way your explanation is spoon feeding, if we see screenshot at the end we get all the details about hashmap .
    I would request create some sessions about springboot .
    1.springboot security (authentication: Authorization)
    2.springboot transaction
    a.what is the purpose of transaction and etc
    3.what is different b/w jdbc/spring jdbc /hibernate/spring data jpa
    4.spring xml vs spring boot
    5

  • @AnkushKumar-fq3mp
    @AnkushKumar-fq3mp 2 года назад +1

    Really nice!

  • @srikarsowbhagya683
    @srikarsowbhagya683 3 года назад +1

    Thanks Bro

  • @dhiraj2934
    @dhiraj2934 3 года назад +2

    Hi sir,
    In your video u used integer value as we are converting from linked list to Tree structure. The no greater than root element is place above and smaller place below.
    But in HashMap they are not number they are also object. Because collection stores only object. Please clarify? I am confused

    • @ankit.wasankar
      @ankit.wasankar  3 года назад

      Correct. I intentionally used Interges because we can easily compare them instead of object. In java we compare objects using natural ordering or implementing Comparable .. U can try with objects as well but then u need to use compare methods for getting order in which they should appear

  • @Imdadullah-FIZFamilyTimes
    @Imdadullah-FIZFamilyTimes 3 года назад +2

    superb explanation ,it cleared the concepts.Kindly post the multiple thread and design pattern concepts of java

  • @snehasavane9141
    @snehasavane9141 2 года назад +1

    very neatly explained basics of working of hashmap,linkedlist,tree

  • @kishyash1
    @kishyash1 3 года назад +1

    if key is 8 than how will insert is it will rearrange ?

    • @ankit.wasankar
      @ankit.wasankar  3 года назад

      Yes.. it's self balanced that means it will rearrange

  • @anujkrmandal404
    @anujkrmandal404 3 года назад +1

    Thank you

  • @mohammadsadeghi2353
    @mohammadsadeghi2353 2 года назад +2

    You are awesome at explaining complex topics. Thank you.

  • @ishachhabra5150
    @ishachhabra5150 3 года назад +1

    Good job 👍

  • @ajayjayswal9139
    @ajayjayswal9139 3 года назад +1

    Starting index of bucket 0 or 1 ?

  • @muchukundareddy5315
    @muchukundareddy5315 3 года назад +1

    Awesome.

  • @lavanyapadma3024
    @lavanyapadma3024 2 года назад +1

    Best Explanation ever…have seen so many videos but this is the best, Thank you 🙏

  • @bharatchoudhary7295
    @bharatchoudhary7295 3 года назад +1

    excellent

  • @apurvaRTink
    @apurvaRTink 2 года назад +1

    Thank you sooo much because of your this video i understood the internal working of hashmap after so many days. Nice explaination...🙏🙏

  • @artworkbysomrita2062
    @artworkbysomrita2062 2 года назад +1

    Just superb explanation. Could you please make tutorial on some LinkedList and Tree programing concepts. TIA

  • @muralikrishna1029
    @muralikrishna1029 2 года назад +1

    Super

  • @aniruddhachunne3011
    @aniruddhachunne3011 2 года назад +1

    that summary work flow is awesome.... it help much better than your whole explanation

  • @learnit4499
    @learnit4499 2 года назад +1

    You are LEGEND man! The way you explained I can answer hashmap even after death :D

  • @vigneshv5092
    @vigneshv5092 3 года назад +2

    Well documented video. Thanks

  • @monica-rk9yn
    @monica-rk9yn 3 года назад +1

    It was a nice explaination..easy to understand👍...Please upload a video on internal working of hashet..

  • @chandutheartist
    @chandutheartist 3 года назад +2

    great video sir. One doubt, what is the value for treefy threshold? and can we modify it?

    • @Gnahnavi
      @Gnahnavi 2 года назад

      TREEIFY_THRESHOLD=8 and NO, we cannot change the default value

  • @Venkat999.
    @Venkat999. 3 года назад

    How can we put the entry in the bucket index like 12, is there any method like map.put(12, "key", "value") ?

  • @ganeshkulkarni9648
    @ganeshkulkarni9648 2 года назад +1

    Wow, what a prefect explanation it was.
    Thanks a lot man for this smooth explanation,
    We're looking forward for many videos, but you have stopped posting it.

  • @dipalijibhakate2815
    @dipalijibhakate2815 8 месяцев назад +1

    A great explanation ,one of the best video till now i watched on Hashmap internal...Thank you for sharing a such content😊

  • @shrutithanekar3464
    @shrutithanekar3464 2 года назад +1

    Thank you so much for this video I was actually able to visualise internal structure of the hashmap

  • @monikapreethi4847
    @monikapreethi4847 2 года назад +1

    thankyou so much. its really excellent explanation with neat slides, think your the best tutor to explain the concept in a simplified manner. I think its the best video on hash map .

  • @maheshchennamsetti549
    @maheshchennamsetti549 2 года назад +1

    I have seen many videos but I am wasn't satisfied with any of them .After seeing this video I got an absolute clarity thanks to this man for explaining in such a detailed way.

  • @scrppr8270
    @scrppr8270 3 года назад +1

    Please Upload more videos.....your explanation is just awesome👌👌👌😍

  • @mohdafzal4017
    @mohdafzal4017 3 года назад +1

    Perfectly done. But I have one question, in the node you are placing both and values but that's not possible right.

  • @aayushiyadav7914
    @aayushiyadav7914 2 года назад +1

    Thank you for the explanation. It's really helpful.

  • @ompa1
    @ompa1 2 года назад

    Using compareTo() method what goes below & above in case of a String value?

  • @dhananajaykrishna8259
    @dhananajaykrishna8259 4 года назад +1

    Best video on working of Hashmap . Also the treeify threshold concept is well explained. Thank you!!

  • @yatinbatra6124
    @yatinbatra6124 3 года назад +1

    Amazing explanation. Thanks. Please prepare some more videos.

  • @ManishKumar-qx1kh
    @ManishKumar-qx1kh 3 года назад +1

    Really aprreciate the hardwork. Cn you please make a playlist of all java collections and their internal working.

  • @deeptimonga7375
    @deeptimonga7375 2 года назад +1

    Excellent content & presentation. Eagerly waiting for the new videos. Please keep up the good work!!!

  • @kumarprakash93
    @kumarprakash93 2 года назад +1

    Appreciated the way you explained the concept. Thank you.

  • @kusumbhatt2168
    @kusumbhatt2168 3 года назад +1

    You explained this concept in detail, this is very helpful... thank you!!

  • @jamshadm
    @jamshadm 2 года назад +1

    Explained very well. Thank you :)

  • @ritesisright
    @ritesisright 3 года назад +2

    Awesome❤️

  • @sandeepkumarrayala6738
    @sandeepkumarrayala6738 2 года назад +1

    You are awesome you explained it so clearly your animation are awesome great work .. You should be in udemy not on youtube .. Impressed with your work ..

  • @shilpakothre4893
    @shilpakothre4893 3 года назад +1

    Thank u for explaining in such a wonderful way. Before watching this video I have lot of confusion in this topic. This clear my all doubts.

  • @amrutapathak6802
    @amrutapathak6802 2 года назад +1

    Bhai Kya explain Kiya hai..Thank you so much...Can you please create video on ConcurrentHash map, Difference between Hashmap, Synchronized Hashmap and Concurrent hashmap

  • @AzeriFire
    @AzeriFire 2 года назад +1

    I have never seen such detailed tutorial about the hashmap! I want to thank you, even I knew how it works.

  • @jitesh1480
    @jitesh1480 3 года назад +1

    V good explanation, simple and on point. Thanks and Keep making more videos like this!

  • @Itsarpitgupta
    @Itsarpitgupta 2 года назад

    Thanks for the wonderful explanation.

  • @pradipr2434
    @pradipr2434 3 года назад +1

    Wow. Well explained the concept with practical example👏 And Thank you for the clear explanation. Your channel deserves more subscribers

  • @AyushmaanPandey
    @AyushmaanPandey 3 года назад +1

    Very precise explanation.Thanks a lot

  • @sandeep_khangar
    @sandeep_khangar 2 года назад +1

    Bro, one of the best video I've seen. Proper explanation , diagram. 🔥

  • @anilmaurya55
    @anilmaurya55 2 года назад +1

    Sir your teaching is so good and simple and so effective...

  • @imanidesireejones9684
    @imanidesireejones9684 2 года назад +1

    wow so easy to understand. I like how you actually explain certain keywords instead of grazing over concepts. this was so helpful thank you!

  • @abhinavdogra3835
    @abhinavdogra3835 3 года назад +1

    Extraordinary explanation pls make more videos in this playlist

  • @nvs4600
    @nvs4600 3 года назад +1

    Thanks so much. It's very helpful for me.

  • @gauravraut3414
    @gauravraut3414 Год назад +1

    your explanation is great . try to make more videos on java .

  • @randhirverma8042
    @randhirverma8042 3 года назад +1

    Thanks, man thanks a lot finally my concept is cleared, One of the best explanation I got on youtube

  • @shyamelakapalli1051
    @shyamelakapalli1051 3 года назад +1

    This is not enough for the interview. What if custom object is used a key without implementing comparator ? How the tiebreaker works when hash collision occurs ? how get method works ?

    • @ankit.wasankar
      @ankit.wasankar  3 года назад

      Yeah.. agree. Didn't except people are really going that deep. Because most of interviewer aren't aware of these concepts. But yeah I guess I should have included that.
      I can create another video on the tieBreakOrder and identityHashCode when actual tree building starts in treeifyBin.
      Thanks for the comments!! 😊

  • @nayanagouda3767
    @nayanagouda3767 Год назад +1

    Tysm for simply explanation... I have seen much vdo bt this is the best vdo.. Tq once again..🙏🏻

    • @ankit.wasankar
      @ankit.wasankar  Год назад

      If you can, please go through my description & give a star to my repo. It'll be very helpful to me. Thank you ✌️

  • @hemkantgangurde8071
    @hemkantgangurde8071 2 года назад +1

    This is really great explanation, thanks

  • @pawankumar-ez9mf
    @pawankumar-ez9mf 2 года назад

    Very good explaining not able to find anywhere else

  • @SouravChatterjeeboss
    @SouravChatterjeeboss 2 года назад +1

    Best tutorial I have ever seen. Thank you.