LinkedHashMap and LinkedHashSet in Java | Internal Working

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 พ.ย. 2024

ความคิดเห็น • 62

  • @srinukolluris
    @srinukolluris ปีที่แล้ว +3

    I have lot of confusion in-between LinkedHashMap vs LinkedHashSet , now everything is cleared, thanks bro, great work.

  • @azimbekomar4401
    @azimbekomar4401 7 วันที่ผ่านมา

    Perfect explanation! Thanks a lot!

  • @gauravsrivastava17
    @gauravsrivastava17 2 ปีที่แล้ว +1

    Plz keep making videos
    And you are completing the whole
    Video in the particular topic
    Makes this channel best place to visit and see

  • @sanketh768
    @sanketh768 ปีที่แล้ว +1

    Thank you for the video sir, didn't think I could find the explanation so easily

  • @nikhilvijay6022
    @nikhilvijay6022 4 หลายเดือนก่อน

    Great work as always❤

  • @ShinAkuma
    @ShinAkuma 2 ปีที่แล้ว +6

    Would you consider making a DSA series ? Covering programming techniques for solvnig different kinds of questions and Data structure related questions asked in FAANG companies.

    • @DailyCodeBuffer
      @DailyCodeBuffer  2 ปีที่แล้ว +15

      Planning on it if more people are interested

    • @gopichinthagumpula6481
      @gopichinthagumpula6481 2 ปีที่แล้ว +1

      ​@@DailyCodeBuffer Yes.. do it please

    • @balachandra6392
      @balachandra6392 2 ปีที่แล้ว +1

      @@DailyCodeBuffer : please consider LLD videos also.

    • @vinaykulkarni4085
      @vinaykulkarni4085 2 ปีที่แล้ว +1

      @@DailyCodeBuffer Please create as these are things which I feel most of people lack and fail when asked in interviews

    • @PremSagarBhamidipati
      @PremSagarBhamidipati 2 ปีที่แล้ว +1

      Please do it.

  • @shakhzodrasulov
    @shakhzodrasulov ปีที่แล้ว

    Thank you a lot! Your explanation is cool and it helped me understand how LinkedHashMap works internally!

  • @vinaykulkarni4085
    @vinaykulkarni4085 2 ปีที่แล้ว +2

    Hi Shabber it was a clear and easy explanation. Please add a video on internal working of ConcurrentHashMap

    • @DailyCodeBuffer
      @DailyCodeBuffer  2 ปีที่แล้ว

      Thank you so much
      Working on it

    • @ShinAkuma
      @ShinAkuma 2 ปีที่แล้ว

      It's the same as HashMap except it does it's write operations in a monitor region and applies a segment level lock on the buckets so only the buckets where data is being written are locked and rest are free for use. Read operations do no require locks at all.

    • @Lallushe
      @Lallushe ปีที่แล้ว

      @@DailyCodeBuffer Concurrent hashmap YES PLS

  • @dipanmandal7607
    @dipanmandal7607 ปีที่แล้ว

    Boht badiya. Too good.

  • @saisreenath4199
    @saisreenath4199 ปีที่แล้ว

    Well explained.

  • @RaviKumar-vk6ib
    @RaviKumar-vk6ib ปีที่แล้ว

    Love you buddy cleared my concept totally

  • @gopichinthagumpula6481
    @gopichinthagumpula6481 2 ปีที่แล้ว

    Will you make a video on Oops.. if possible?

  • @monsuruokuniyi1234
    @monsuruokuniyi1234 2 ปีที่แล้ว

    This linkedhashmap seems pretty complicated. Nicely explained. Why use this rather than a hashmap. Thank you

    • @DailyCodeBuffer
      @DailyCodeBuffer  2 ปีที่แล้ว +1

      To maintain insertion order

    • @dmitrikonnov922
      @dmitrikonnov922 2 ปีที่แล้ว +1

      1) you might want to copy a map with guaranteed the same order as in the origin map
      2) you might want to keep track of insertions for instance by implementing LRU-cache. For this particular case you'd use following constructor: public LinkedHashMap(int initialCapacity,
      float loadFactor,
      boolean accessOrder)

    • @DailyCodeBuffer
      @DailyCodeBuffer  2 ปีที่แล้ว

      Thank you for detailed information

    • @dmitrikonnov922
      @dmitrikonnov922 2 ปีที่แล้ว +1

      @@DailyCodeBuffer Was pleasure. I like your content. Honestly, mentioning implementation of lru-cache was kinda unrealistic of me. I think, Coffeine has ConcurrentLinkedHashMap, which almost covers all needs, unless we're dying to create something very special and customised.:D

  • @MutantBikers
    @MutantBikers 2 ปีที่แล้ว

    Happy to see you again bro 🙂🙂

  • @faixan13
    @faixan13 2 ปีที่แล้ว +1

    Thanks for the detailed explanation.
    One question what about the uniqueness of elements ? Because it is unique in set always so it will always be unique in linked hashset also?

  • @TechOnScreen
    @TechOnScreen 2 ปีที่แล้ว

    amazing explanation !

  • @kunalsharma-zc2ho
    @kunalsharma-zc2ho 2 ปีที่แล้ว

    can you made an vedio on Equals and hashcode also with various cases..sometimes it comes confusive : (

  • @mihirshinde4268
    @mihirshinde4268 ปีที่แล้ว

    What is the Difference between Node and a Entry ?

  • @brahmamk7771
    @brahmamk7771 2 ปีที่แล้ว

    If hash collision happens then how linkedhashmap() works internally? . Thanks in advance

  • @erwinrussel2086
    @erwinrussel2086 ปีที่แล้ว

    Thanks!

  • @tabishquadri
    @tabishquadri 2 ปีที่แล้ว

    ladka sahi samjhaya hai 👍👍

  • @sufyankhot7520
    @sufyankhot7520 2 ปีที่แล้ว

    What if the key is an object? Will the next and before be resolved by sorting whatever is returned by the hashcode()?

    • @dmitrikonnov922
      @dmitrikonnov922 2 ปีที่แล้ว

      Besides of delicacy going hand in hand with making use of objects as keys in HashMap: At first: hashcode() on your key-object is called, after that the link to your object is copied into the array's node, after links "next" and "before" (or whatever they're called in java) are renewed, pointing to the node. Were your key-object mutated in the meanwhile, it wouldn't have no impact of next and before pointers. But the hash is toast now, I mean whether mutation changes hash code or not, which is also pretty easy to implement, either way make the value unreachable outside of the map sooner or later, but because the pointers inside the map still live, the value is hardly going to be garbage-collected, unless we make use of weak- or softHashmap.

    • @dmitrikonnov922
      @dmitrikonnov922 2 ปีที่แล้ว

      in short-lived-objects it can by considerable, but in long-term state like caching or it can cause a huge pain in the ass. As for me. imho

    • @dmitrikonnov922
      @dmitrikonnov922 2 ปีที่แล้ว +1

      Well, if we have to do with kinda object that we send to the client and later it's supposed to come back, well then our client will probably have done some mutations on it, won't it. That's why I'd rather call hashCode() on our object-to-send by myself, put this hashcode integer value as key into the map and store it into the specific field in our object-to-send. Once it's back again, I just get the stored value from the field and can keep using it as key. The hashCode() here works like an non-unique id.

  • @richajava4346
    @richajava4346 6 หลายเดือนก่อน

    What is head and tail.

    • @nikhilvijay6022
      @nikhilvijay6022 4 หลายเดือนก่อน

      head is the start of the LinkedList & tail is the end of LinkedList. Understanding Linkedlist would help in understanding hashmaps better

  • @boorlamadhu2643
    @boorlamadhu2643 2 ปีที่แล้ว

    Good more helpful 👍

  • @shobhitgour1149
    @shobhitgour1149 2 ปีที่แล้ว +1

    Yesterday in an Interview,this question was asked to me..i could not explain it..😞😞

    • @DailyCodeBuffer
      @DailyCodeBuffer  2 ปีที่แล้ว

      Hope this video helps and you will rock next interview

  • @kavitapatil5285
    @kavitapatil5285 2 ปีที่แล้ว +1

    first one 🙏🏻