LinkedHashMap and LinkedHashSet in Java | Internal Working

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ก.ย. 2024
  • Start protecting yourself on the web at nordvpn.com/dcb or use code "dcb" to get a 2-year plan plus a bonus gift with a huge discount
    In this video, I have explained what is LinkedHashMap & LinkedHashSet in Java and How LinkedHashMap & LinkedhashSet works internally with full-example
    🎟 Join this channel to get access to perks:
    / @dailycodebuffer
    RECOMMENDED COURSES
    🎬 Spring Boot + React Full Stack Web Application with Tailwind CSS - • Spring Boot + React Fu...
    🎬 Spring Security Full Course | From Registration to Login - • Spring Security Tutori...
    🎬 Microservices using SpringBoot | Full Example - • Microservices using Sp...
    🎬 Event-Driven Microservices with CQRS Design Pattern - • Implement CQRS Design ...
    🎬 Implement SAGA Design Pattern using Spring boot and Axon Framework - • Implement SAGA Design ...
    🎬 Spring Data JPA Tutorial | Full In-depth Course - • Spring Data JPA Tutori...
    🎬 Deploy Springboot Microservices to Kubernetes Cluster - • Deploy Springboot Micr...
    🎬 Automate Microservices deployment with Github Actions - • GitHub Actions Tutoria...
    🎬 Go / Golang Full Course for Beginners - • Golang Tutorial for Be...
    🎬 Node JS Full Course for Beginners: Learn in 2 Hours - • Node JS Full Course fo...
    🎬 Express.js Tutorial - Beginner | 2021 - • Express.js Tutorial - ...
    🎬 Redis CLI Tutorial | Complete Course - • Redis CLI Tutorial | C...
    BE MY FRIEND:
    👨‍💻. Website: www.dailycodebu...
    👨‍🏫 Facebook: / dailycodebuffer
    🐦 Twitter: / dailycodebuffer
    📸 Instagram: / dailycodebuffer
    🎮 GitHub: github.com/dai...
    MY FAVOURITE GEAR:
    👨‍💻 My Macbook Air M1: amzn.to/3eFXlID
    💻 ASUS ROG Zephyrus G14, 14": amzn.to/32xsXhf
    💻 ASUS ROG Zephyrus G14, 14" (US): amzn.to/3xa6X6m
    🎤 My Main Mic: amzn.to/3qDl0z0
    🎤 My Main Mic (US): amzn.to/3awzUj7
    🎙 My Secondary Mic: amzn.to/3sOZCJW
    🖥 My LG Monitor: amzn.to/3zhLY3e
    🖱 My Mouse: amzn.to/3eDpRKT
    ⌨️ My Keyboard: amzn.to/32xthMZ
    RECOMMENDED BOOKS:
    📙 Mastering Spring Boot 2.0 (Kindle): amzn.to/3HsOiHu
    📙 Mastering Spring Boot 2.0 (US): amzn.to/3tHNUy5
    📙 Building Microservices(Kindle): amzn.to/3gsA1jL
    📙 Building Microservices(US): amzn.to/3dDnfNn
    📙 Spring Boot in Action: amzn.to/32Nf3qW
    📙 Spring Boot in Action (US): amzn.to/32DkeX9
    📙 Spring Microservices in Action: amzn.to/3mQ4sCH
    📙 Spring Microservices in Action(US): amzn.to/32G3Hl7
    🎻 MUSIC:
    🎵 Hear the Noise (Sting): www.youtube.co...
    “Sound effects obtained from www.zapsplat.com“
    #collections #Linkedhashmap #linkedhashset #java #DailyCodeBuffer

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

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

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

  • @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

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

    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.

  • @sanketh768
    @sanketh768 11 หลายเดือนก่อน +1

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

  • @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

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

    Great work as always❤

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

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

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

    Boht badiya. Too good.

  • @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?

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

    Love you buddy cleared my concept totally

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

    Well explained.

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

    What is the Difference between Node and a Entry ?

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

    amazing explanation !

  • @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

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

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

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

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

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

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

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

    Thanks!

  • @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

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

    Good more helpful 👍

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

    ladka sahi samjhaya hai 👍👍

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

    first one 🙏🏻

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

    What is head and tail.

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

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

  • @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.