25. Collections in Java - Part4 | HashMap Internal Working in Java

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

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

  • @tanujarora4906
    @tanujarora4906 9 หลายเดือนก่อน +7

    Hi , 1.5 year experienced engineer working in Service Based,
    I went for an interview for a Hyderabad based startup he told me dude you have knowledge of a 5 year experienced guy.
    Just follow this playlist you are good to go for any company
    Fodd doge koi bhi java interview.
    Tcs, infosys toh mazaak lagengey iske baad😂
    Thanks bhai❤

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

      thanks a lot buddy

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

      What tech stack are you working on currently?

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

      Java, Spring(Not boot), Weblogic, oracle database.(Legacy code like other service based companies)

  • @code4logics
    @code4logics ปีที่แล้ว +9

    u make the concept as butter like smooth , next level teaching skills u have

  • @ThrottleJourneys
    @ThrottleJourneys 8 หลายเดือนก่อน +2

    Explained the same in Phonepe sde interview , cleared the round. Thanks bhai love u

    • @ConceptandCoding
      @ConceptandCoding  8 หลายเดือนก่อน +1

      all the best for further rounds buddy 👍

    • @SrishtiJaiswal-v5m
      @SrishtiJaiswal-v5m 2 หลายเดือนก่อน

      What was the question?

  • @deepsinghrajput2211
    @deepsinghrajput2211 4 หลายเดือนก่อน +1

    Ty Shrayansh Excellent explanation

  • @sushantbasak1647
    @sushantbasak1647 9 หลายเดือนก่อน +1

    Amazing explanation, learned this complex topic in a very easy way.

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

    I always wondered that if we get only one map for all value, then how it's handled. Thanks for such wonderful explaination.🙌

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

      "only one map for all value" what do u mean?

  • @ManishVerma-si8nv
    @ManishVerma-si8nv ปีที่แล้ว +1

    Great video Shrayansh 👌👍

  • @bhuvanakuppusamy6933
    @bhuvanakuppusamy6933 5 หลายเดือนก่อน +1

    Excellent explanation of HashMap. Thanks Man.. Really helpful :)

  • @shivansamala7862
    @shivansamala7862 7 หลายเดือนก่อน +7

    A small correction when we use (null) as key by default, it stores at index 0 of the bucket.

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

      Yes. Hash of null points to 0

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

    second time i watched the full video. It gives much confidence now. Thank You so much. And I request you to please make a video on multithreading and java 8 features.

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

    interviews one of the hot question

  • @ManjeetKaur-y1y
    @ManjeetKaur-y1y 10 หลายเดือนก่อน +2

    Hi Shrayansh please also explain the internal working of concurrenthashmap..

  • @vismayaashok7230
    @vismayaashok7230 25 วันที่ผ่านมา

    Hello Shrayansh,should we have be aware of the algorithm to find the hashcode or it will be internally calculate and who will provide that algorithm to find the hashcode?

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

    the explanation you do is awesome. I have some doubts
    48:19
    when you stored key 2 and value B , it should stored in the array first na ? you have written outside the index 3 block.
    another doubt ,
    is there any order for load factor and treefy thresholding ? I think that as per the scenario either of these 2 could come to the action , am I right ?

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

    I have 2 doubts.
    1) 37:52 does it count the horizontal values also before doing re-hash for 13 nodes (16*0.75 + 1)? Suppose I have 13 nodes..
    and 7 of them are forming a linkedList. Will it count it as a scenario when it have to do re-hash or does it wait till the
    moment 13 nodes gets filled vertically?
    2) If both load factor and treefyThreashold gets crossed at same time which one will heppen first?
    At 26:59 here as per example the key 5 is producing two different hash values. I think that is a mistake.

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

      Ack, will answer by eod.

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

      Hi,I am also having the same questions. can you please address these.
      And also while calculating the index after getting hash value and dividing the hash value by size, in this are we also considering the LinkedList that were created on collision or are we only considering initial size of array of nodes

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

    Thank You so much. Eagerly waiting for this..

  • @KishanKumar-ny3zk
    @KishanKumar-ny3zk ปีที่แล้ว +1

    Hi Shrayansh, Thank you for the way you explain. One question is that when I can expect videos on java concurrency.

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

    Hello Shryansh, really good details in a simpler way . I have one doubt. If in key we store any Object then we need to override that particular class's hashCode() method. But what will happen in case of coelution ? Then how we will compare while getting value? How we will compare hashValue of key and key object?

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

    Hi Shrayansh, just wanted to ask whether the HashMap is occupying contiguous memory when it is calculating hash for the particular size?

  • @AbhrajitChowdhury-nm8im
    @AbhrajitChowdhury-nm8im 6 หลายเดือนก่อน

    Hi Shrayansh,
    Can you please add the full internal code implementation of the HashMap ? I was asked this in an interview..

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

    Hey shreyansh, excellent video.
    I have one request though, can you make a video on spring boot learning path and resources from which one can learn.
    I am coming from python django background and recently giving the interviews and most of the time, the requirementb is of java and spring boot.
    I know you will create a series on spring boot going forward but if you just make one video for now which covers the introduction and resources and what are important interview question then it will be immensely helpful

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

    Hey shreyansh, I had a doubt suppose initially when the length of array is 16 I put key as 'A' hash will generate for 'A' and it will mod with 16 we will get the index for it correct. Suppose after some insertion the array size increased to 64 and we again tries to put key 'A' for updating the value, now for 'A' same hash will be generated but this time we are going to mod with different size that is 64 so we will get the different index for 'A'.

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

      Right

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

      So shreyansh, how the value for that key will be updated, if we got different index for same key

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

      But when size of hashmap changed to 64 then rehashing will happen and
      indexes also will be modified according to new size and keys in each bucket will be redistributed according to new hashing and indexes

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

    Hi shreyansh,
    Thanks for amazing video!
    I have a doubt on Java Date class.
    sometimes we code across the code that uses different flavours of Dates.
    someone uses Date, DateTime, ZonedTime - as per their comfort also hell lot of utilities that provides date and DateFormatter() its all rabbit hole now.
    Assuming a new guy in java what are the best practices to use proper class of Date??
    Is there any standard like given 100s of Date classes always use these 2 or 5 class??

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

      Nice question, i think i should also cover this as an ad-hoc topic in java

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

    Hey Shreyansh, just one doubt suppose rehashing is happening then its size will be increase and old entry has some hasing value and based on these hasing value index were generated using logic(hashvalue%sizeofArray) now after rehasing and we have called put method and so again it will generate the hasValue which will be same as old one but this time while generating index it will different because this time index = hashValue % size of array and this time of size of array will be different how it work for keys whose were stored before rehashing?

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

      Rehashing of keys happens whenever HashMap size increases.

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

      when resizing is occur, the new array is created the all the values from old are shifted based on the newly created index in new array. after that when some put method will be called its stored in newly created array.

  • @Placement-bv9cg
    @Placement-bv9cg ปีที่แล้ว +1

    hey shreyansh, can u explain the difference between putIfAbsent and put

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

      putifAbsent ->
      if key already exists return the value already associated, else create a new mapping with this key and value.
      put ->
      if map already has the same key present it will overwrite the value now provided and do not have the key present: it will add new key-value mapping.

    • @Placement-bv9cg
      @Placement-bv9cg ปีที่แล้ว

      @@ConceptandCoding what about in null cases ??

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

      @@Placement-bv9cg putifAbsent: if value is null it will update the value.
      Do practice out with different scenarios buddy

  • @Sanjeev.Network
    @Sanjeev.Network ปีที่แล้ว

    I just want if you can share the document which you use for explaining that will be better at time of revision. Thank You

  • @ayushraj-zb6sv
    @ayushraj-zb6sv ปีที่แล้ว

    from interview perspective , what all topics should I focus in collection s?

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

      HapMap, internals is very imp.
      And usage of collection like in which scenario what to use and how is also imp

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

    Hey Shryansh, Can you please let me know if we can store like 2 different Student Objects with same values as a key. Then what's happened ?

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

      it will overwrite the value, because we can't store duplicate keys in hashmap

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

    Hey
    If we rehash/resize, then I think we cannot use %N to find an index, the problem we solve with consistent hashing, right?

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

      when resizing is occur, the new array is created the all the values from old are shifted based on the newly created index in new array. after that when some put method will be called its stored in newly created array.

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

    Why other videos of java are only for members ? Some days ago they were public ??

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

      No Sarkar, Java from start is member only video.

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

      @@ConceptandCoding nope I have watched some videos now they are member only

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

      Anyways if I found them good I'll take membership

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

      please every video for members why you public some video?

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

      @@dayashankarlakhotia4943 hi, i got requests to open some videos, so that engineers can see if they find it useful or not. That's the reason.

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

    Hi Shreyansh! Notes for this lecture is not uploaded?

  • @PavanV-y5l
    @PavanV-y5l 13 วันที่ผ่านมา

    Java notes for lecture 23,24,25,26,27 is corrupted and does not show notes of 24,25,26,27. Sir, can you please re upload the notes?

    • @ConceptandCoding
      @ConceptandCoding  13 วันที่ผ่านมา

      thanks for the update, i will check today and update it

    • @PavanV-y5l
      @PavanV-y5l 13 วันที่ผ่านมา

      @ Thank you sir

  • @RishabhVarshney-k7z
    @RishabhVarshney-k7z หลายเดือนก่อน

    I want to purchase your course but dont have visa and mastercard. I have other card which they are not accepting. Why dont you add UPI to the list?
    -A Student

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

      it’s all handled by TH-cam itself buddy

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

    same can u teach for Custom ArrayList also if possible , would be really great

  • @--SaikrishnaR
    @--SaikrishnaR 9 หลายเดือนก่อน

    wow