Java collections interview questions | Why HashMap Keys are Immutable? | Immutability & HashMap

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ก.ค. 2024
  • In this video, We will discuss a few of the java collections interview questions which are asked so many times in the java interviews. So Hashmap and Immutability are closely related in java and it is expected to have counter questions from the interviewer. So let’s prepare some of the top collection framework interview questions in java.
    Prerequisite: how hashmap works internally?
    Why hashmap works internally? [Playlist]
    • How HashMap works inte...
    Lesson: #2 Interview questions on Java Immutable class and HashMap [ mmutability & HashMap ]
    Timestamp :
    Introduction : 00:00:00
    What happens when we use mutable objects as HashMap Keys? 00:06:19
    Breaking the hashmap properties - 00:12:35
    the role of hashcode() in hashmap internal working in java - 00:14:18
    Why HashMap Keys are Immutable? - 00 :18:51
    the hashcode caching factor- 00:28:18
    What will happen if the immutable classes are not marked as final? - 00:35:10
    Subclass a immutable object- 00:38:01
    Breaking immutable objects: 00:48:51
    The impact of immutability on hashmap: 00:51:41
    Reasons why the immutable class should be marked as final:00:54:51
    String Vs StringBuffer- 00:57:45
    So if you are looking for some top collection framework interview question/java interview questions and answers for experienced / java interview programs for freshers with answers; the above are some questions that you should try out.
    for more java interview questions/java interview questions and answers for experienced /java interview questions and answers for freshers, consider subscribing to my channel.
    / @seleniumexpress
    #CoreJavaInterviewQuestion #FAQForfreshers #FAQForExperienced
    More core java interview questions :
    Why String is immutable?
    • Why string is immutabl...
    String Hashcode caching internally. Hashcode caching for immutable classes (important)
    • This is why string is ...
    java interview questions and answers for experienced / Freshers [playlist]
    • TOP 6 difference betwe...
    For more courses visit
    www.seleniumexpress.com
    Any time you are getting stuck with issues, Feel free to ask for support.
    You can send mail to seleniumexpress@gmail.com
    you can ping me on my Facebook page
    / seleniumexpress
    Make sure to join my private Facebook page (Ask me here)
    “SeleniumExpress - Support”
    / 187000222361579
    you can ask for support in my website forum
    www.seleniumexpress.com
    Follow me on Insta
    / selenium_express
    Music :
    -----
    credits : -
    (channel intro)
    Adventures by A Himitsu / a-himitsu
    Creative Commons - Attribution 3.0 Unported- CC BY 3.0
    creativecommons.org/licenses/b...
    Music released by Argofox • A Himitsu - Adventures...
    Music provided by Audio Library • Adventures - A Himitsu...

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

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

    Nagarro round 3 Interview ques 2021:
    -lambda expressions
    -prime numbers 1-50(using streams also)
    -Marker interface
    -spring annotations
    @Controller
    @Bean
    @Component
    @RestController
    - difference b/w @RestController and @Controller
    - .equals() and hashcode contract
    - diff between HashMap and HashSet
    - Callable interface
    - 2,3 input / output ques related to spring
    1) one interface implemented by 2 componnets will it work? (@Qualifier) concept
    - try/catch with resources
    - HashMap implementation
    - API gateway
    - explain bean life cycle
    thanks a lot @selinuim express your videos helped me a lotttt 💙

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

    I am running out of words to express my gratitude towards your efforts.I am feeling confident about this topic now.

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

    Writing code and breaking our own code and make it to work, that is awesome 😀

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

    You are great at explaining these concepts and really bring your point home with your awesome examples!!! I'm definitely a better developer bc of you! Thumbs up on all your videos!!!

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

    omg i just love the way you explain things. One of the best online platform to learn basic and master advance

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

    Thanks for your knowledge sharing, please provide more videos on Java interview perspectives....like Core Java, Java 8 videos.

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

    I am not lying) But Abhilash you are the best of the best teacher on whole youtube. You have your own style of explanation and providing information. Thank you very much. It would be great, if you make video about multi-threadding in same style. Because it is very hard part of questions in interview and also difficult topic to understand. And thank you that you speak in english, I am from Kazakhstan and it is good way learn Java from great teacher, like you

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

    Excellent explanation .Expecting more of this type. Thank you so much

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

    Only one word fantastic man
    As a working professional I used to deep dive with your content

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

    This was explained beautifully!

  • @amitpandey-xe4zs
    @amitpandey-xe4zs ปีที่แล้ว

    Hi Abhilash, thank you for the training you provide. it has taken my java and spring-boot knowledge to next level.👌

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

    Excellent explanation... I believe even most of the developers don't know these concepts...

  • @KrishnaSingh-ci9zz
    @KrishnaSingh-ci9zz 3 ปีที่แล้ว

    Love the way you explain. It helps a lot

  • @OrdinaryTalesofSamriddhi
    @OrdinaryTalesofSamriddhi 3 ปีที่แล้ว

    Thanks a lot. This video has helped me a lot in my interview. You are the best.

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

    The way u explain the concept it's really appriciated sir please make a vedio for multithreading concept as well .

  • @viveksharma878
    @viveksharma878 3 ปีที่แล้ว

    Very useful and amazing explanation, Thanks

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

    Great explanation.this deserves more views 👍

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

    best explanation + code demonstration

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

    you are always superb you just don't need any feedback you are too good that's we all feel

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

    just got to your channel, great work fam 🙏

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

    Nice series.. Please bring similar series for spring boot as Spring boot interview questions and answers.

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

    Just awesome explaination 👏👏

  • @ravigarg6521
    @ravigarg6521 3 ปีที่แล้ว

    Thankyou so much for this I never thought I am able to learn hashmap and String its really helpful watchin your video give me confidence and the best part is that , that I now the answer before you explain it , though right know I am not good in coding but I am happy at least I know the concept .
    I have one request can you create a video on Thread or if there is any video link for the same

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

    Thanks to cover this topic.

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

    so much knowledge in single video

  • @rahulpant7795
    @rahulpant7795 3 ปีที่แล้ว

    awesome explanation. thanks.

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

    Just outstanding...

  • @pixo-pixel
    @pixo-pixel 3 ปีที่แล้ว +6

    could you make video on thread advance interview questions?

  • @akshaybhujbal6795
    @akshaybhujbal6795 3 ปีที่แล้ว

    Learned something new today

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

    Excellent work 👏

  • @NITISHKUMAR-nx9mk
    @NITISHKUMAR-nx9mk ปีที่แล้ว

    Very Nice Explanation!

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

    Mind-blowing content ♥️

  • @rb1239978
    @rb1239978 3 ปีที่แล้ว

    great explaination :)

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

    Just subscribed your chanel.. it is too much helpful for me.. Thanks Abhilash

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

    Thank you...so much 🙏🏻🙏🏻🙏🏻

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

    bhai maza asigala video dekhi masth achi ❤❤❤

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

    Abhilash the way you explaining I just feel like you are my close buddy sitting next to me who explaining me before to go an interview. Cool man.. Thank you BRO❤️

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

    Awesome tutorials...👍

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

    Thank you very much Abhilash

  • @reasonbehindeverything
    @reasonbehindeverything 3 ปีที่แล้ว

    very good explanation sir

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

    Thanks Abhilash

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

    I subscribed , thanks a lot for all.

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

    Thanks🙏

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

    Great work..

  • @Aakashkumar-re7gk
    @Aakashkumar-re7gk ปีที่แล้ว

    Kya mast samjhaya 🙏

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

    thank you for awesome content

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

    Well explained

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

    Nice one man

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

    Excellent bro

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

    Thank you Abhilash .You provide very depth knowledge on many topics. Please complete Solid design pattern series. Also put your UPI bar code ,So whoever feel to pay GuruDaxina ,can express gratitude based on his/her capacity.

  • @224sanjeev
    @224sanjeev 2 ปีที่แล้ว

    Nice work brother

  • @rituparnadeshpande3821
    @rituparnadeshpande3821 3 ปีที่แล้ว

    Hello Abhilash , I took on some another youtuber's video first and then when i couldn't understand I watched yours and then found out that, that video was just copied from your video and still couldn't explain it the way you did. Thanks for your spread of knowledge keep it bro 👍🏻

    • @rituparnadeshpande3821
      @rituparnadeshpande3821 3 ปีที่แล้ว

      Also forgot to mention, your detailed explanation helps make it simple and please keep having these details as they are necessary for the thorough understanding and hence are not lengthy.

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

    thanx....a lot

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

    Sir thank you so much for this ... Can you plsss upload whole series of java 8 ?? I really need it !!

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

      Go and search Java Techie channel. There you see Java 8 playlist. He explained very well all the concepts.

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

      Go for Durga lectures

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

      @@ashishchoudhary9824 yes,I do agree. Basant is a nice guy ! I surely recommend you to Check his videos. He makes awesome Contents.
      @all
      I do encourage you guys to follow other TH-camrs Java8 contents instead of waiting for mine.
      As someone mentioned, already there are java 8 contents available on Durgasoft and Java Brains as well !
      All these people are best on youtube, and please consider utilising the resources available. Happy learning 😊❤

    • @ashishchoudhary9824
      @ashishchoudhary9824 3 ปีที่แล้ว

      @@SeleniumExpress So nowdays good Java community we have, where all the good content creators supports other content creator. And now this community should grow so that new students can get benefit.

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

      @@easysfdc agree

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

    Good content

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

    🎉🎉🎉

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

    You are a kind of bahubali in java

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

    very nice sir

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

    Hi Abilash, what is the use of overriding super class getName() method in subclass? without overriding this also we can be able to break the behavior.

  • @babum6194
    @babum6194 3 ปีที่แล้ว

    👍

  • @rohitsharma-xt8qe
    @rohitsharma-xt8qe 2 ปีที่แล้ว

    Hi Abhilash at 44:05 , Why you have overriden getName methods of student immutable class ? You have not used in the main class ?

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

    What if we re-initialize the same existing object instead of setting a value like below
    student = new Student("XYZ")
    This returns null when the get method is called.

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

    great explanation. I have question If two object have same hashcode like 111222 then it will go same bucket ok then how get() method will work. and another how to resolve hashcode Collision.

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

    @seleniumExpress I hope you can reply this:
    When you do
    Student.setname("otherName") you are creating a new string right? Because the first string Is inmutable.
    Please Let me knw

  • @Anand-07
    @Anand-07 ปีที่แล้ว

    I have faced one question and in confusion with the explanation that I can think of.
    If I am using String property inside a Immutable class is it mandatory for that property to make it final?
    because as we know String is Immutable itself so why are we using final with the String property or as a matter of fact with any Immutable property that we are using inside our custom immutable class.
    In search of an answer

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

    if we make the get method as final and also equals and hashcode method as final then do we have the need to make the class final?

  • @vishalthapa1440
    @vishalthapa1440 3 ปีที่แล้ว

    why we need to declare class members as final instead of just removing setter method in that case also we cannot set value to members since there are no setter methods.

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

    If we dont give equals and hashcode method in FakeStudentMutable class, things are working. How ?

  • @PraveenKumar-vh2qm
    @PraveenKumar-vh2qm 3 ปีที่แล้ว

    How Final class double extends Number class?

    • @kostadani2022
      @kostadani2022 3 ปีที่แล้ว

      A final class can extend another class but a final class cannot be extended. So you can extend public abstract class Number(not final), but you can't extend public final class Double because it's final

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

    #Interview ques nagarro last round
    - difference between arraylist and linkedlist
    - difference between sleep()and wait()
    - difference between race condition and deadlock
    - why we use synchronised on block when we can use it on method
    - why we use serialization
    - how we validate path in java
    - classnotfound vs classdefinitionnotfound
    - count num of zeroes in binary represntation of a number
    - checked and unchecked exceptions
    - given arraylist get unique elements and maintain the order
    - real life example of linkedlist
    - clonning concept in java
    - ways to create object in java
    - does applying synchronised on a method solve race condition problem if method has a static variable ?
    - worked on azure?
    - what all we need to consume REST APIs provided by third party service
    - how to make class immutable

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

      Thanks for sharing👍

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

      @@Salimsh12y will share for the 1st round also :)

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

      Thank you for sharing :)

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

    Waiting for abstraction from oop.

  • @TravelwithJay-rc6zz
    @TravelwithJay-rc6zz ปีที่แล้ว

    Interviewer asked me if I will put map.put(null, 1) twice, then when I will try to get the value using null key, what will be the output?

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

      Last one will come output cause of override null key and value.. It will store 0 th bucket only..

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

    Please put java8 features video

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

    Why all wrapper classes are immutable ? This question was asked in one of my interview, Please help me with the same. Thanks in advance :)

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

      Everytime can store data into different memory location once modify or add data 😊

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

      That is mutable whereas immutable doesn't change state or value

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

    Will request to go bit fast .. do not repeat same statements again n again ..

  • @shubhamthakare7694
    @shubhamthakare7694 3 ปีที่แล้ว

    Is Priya is your GF or Wife?

  • @zeeshankhursheed3536
    @zeeshankhursheed3536 3 ปีที่แล้ว

    bhai tum kitte mote hogaye 😂

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

    concepts is good but yaar struggling to explain in English? try cambly..

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

    Just awesome explaination 👏👏