HashMap Java Tutorial #50

Поділитися
Вставка
  • Опубліковано 1 чер 2024
  • $1,000 OFF ANY Springboard Tech Bootcamps with my code ALEXLEE. See if you qualify for the JOB GUARANTEE! 👉 bit.ly/3HX970h
    This HashMap java code will teach you HashMaps in java easily ✅Hopefully, this HashMap Java tutorial will help you start programming using hashmaps.
    Learn java in just 13 minutes: • Learn Java in 14 Minut...
    A HashMap in java is just a list of keys, on the left, that have values on the right. So for example,
    a = 3;
    b = 5;
    c = 1;
    can be stored inside of a hashmap like this:
    myHashMap.put("a", 3);
    myHashMap.put("b", 5);
    myHashMap.put("c", 1);
    a, b, c are the keys
    3, 5, 1 are the values
    This HashMap Java code can be tricky at first... But SURELY you'll get it :) If you followed along, congrats! You learned-by-doing!
    I hope you enjoyed this HashMap java tutorial! I like to have a nice mix of tutorials and actual projects for you all :)
    Are you using HashMap for school?
    Full Java Tutorial For Beginners Playlist: • Full Java Course by Al...
    Free Tips: bit.ly/3U6HXcb
    Disclosure: The Springboard link provided is linked to my affiliate account & supports the channel.
    ~
    Alex Lee

КОМЕНТАРІ • 431

  • @alexlorenlee
    @alexlorenlee  7 місяців тому +1

    If you’re new to programming but want a career in tech, I HIGHLY RECOMMEND applying to one of Springboard’s online coding bootcamps (use code ALEXLEE for $1,000 off): bit.ly/3HX970h

  • @latedeveloper7836
    @latedeveloper7836 3 роки тому +162

    Exemplary tutorial, as always. Timings + my notes below that might help others:
    1:45 An example of how hashmaps can help
    2:05 Creating and naming a hashmap
    2:40 How to add values to a hashmap using the .put method
    3:52 Why you should use a generic and data type for type safety when creating a hashmap + how to add this
    4:25 Why you need 'Integer' [i.e. class type] for a hashmap (can't take primitive 'int' type)
    5:00 Test print of hashmap (default output displays in set notation)
    5:30 Calling a specific value from the hashmap - .get call
    5:50 Start of more advanced hashmap functions - user + password example
    6:15 Creating a hashmap with specific type for type safety
    6:33 How to add users and passwords - .put method
    7:32 How to remove elements from a hash map - .remove method
    8:08 Check if hashmap contains a specific value - .containsValue
    8:42 Difference between Values and Keys in a hashmap using .containsValue and .containsKey method calls
    9:23 How to replace a value (password) - .replace method
    10:10 Key difference between hashmaps and array lists - hashmaps don't have a specific order whereas array lists have an index
    11:00 Simple summary of what a hashmap is

  • @burakgul2136
    @burakgul2136 4 роки тому +224

    This video is awesome. Your english is clear and understandable. I like it 👍

    • @7own878
      @7own878 3 роки тому +18

      Here, after concentrating to get what was said in the Indian accent, one time too often.

    • @bobbobertson9063
      @bobbobertson9063 3 роки тому +7

      @@7own878 it gets tiring to heat the same accent from computer science tutorials all the time

    • @rxtechandtrading
      @rxtechandtrading 2 роки тому

      I know...we can actually understand this man, unlike all the other idiots who make tutorials

  • @ulanalibek7225
    @ulanalibek7225 4 роки тому +112

    Yes the name itself used to make me think that this HashMap thing is one of the most complicated things in Java. Your tutorial made it look like a piece of cake. :) Thanks! keep up the good work.

    • @waterflowzz
      @waterflowzz 2 роки тому +3

      It’s not complicated to use but the implementation of a hash map is a bit more complex than just a 2d array. Hashmaps use a hash function to store the key value pair so that it doesn’t have to go through the whole hashmap using a for loop, Big O(n), when looking for a key. The hash function lookup makes it so that it is Big O(1). In other words the hash function makes it so that the lookup of a key is faster.

  • @enochphetteplace8729
    @enochphetteplace8729 4 роки тому +50

    This is actually the best description of HashMaps I have seen yet

  • @josephsanchez2061
    @josephsanchez2061 4 роки тому +40

    I don't know if you'll see this since it's an older video but you're probably the only programming tutorial UA-camr that's relatable. The rest of them are super smart and do know what they're talking about (so are you obviously) but for some reason, you admitting that a certain topic or part of a topic confuses you helps me understand the material more when you explain it.

    • @unitedtomato5444
      @unitedtomato5444 2 роки тому +6

      He understands what not knowing something was like. I really appreciate that!

  • @Greenmarty
    @Greenmarty 7 місяців тому +1

    2:00 It's called HashMap because it uses hash key to access values in the background and implements Map interface and extends AbstractMap class.
    If you would write your custom HashMap it would be array of linked lists. Length of the array would not be equal to number of stored key-value pairs. Instead array stores linked list heads, where each list node has hash key, value and points to next node. Hash key is hash version of the key you inserted. To access the value nodes are iterated until hash key matches.

  • @nelimalu601
    @nelimalu601 4 роки тому +193

    For anyone with a python background, hashmaps are the same as dictionaries.

  • @anilsuyal
    @anilsuyal 4 роки тому

    i have watched too many java channels but i found you is the best the best thing about is you is you start to explain a topic in such a way that nothing more required to learn that perticular topic. please bother upload all the java tutorials like spring mvc swings etc.

  • @gnovakov
    @gnovakov 3 роки тому +6

    Love your tutorials, so clear and concise! you just get to the point and it just makes sense!

  • @MaximumJoy
    @MaximumJoy 4 роки тому +23

    This is so helpful. Your explanations and presentation are perfect.

  • @groupcoop409
    @groupcoop409 4 роки тому +6

    Best hashmapping tutorial! super easy to understand well delivered! more tutorials to come THANKS! :D

  • @skat4
    @skat4 2 роки тому

    Been studying for my Software Engineering Interview, and these videos are so helpful!

  • @ovey2214
    @ovey2214 3 роки тому +2

    Thank you for explaining things so well. You make otherwise complicated things sound so easy to understand. Bless you brother!

  • @Brlitzkreig
    @Brlitzkreig Рік тому +2

    So glad to see how your channel has grown over time. You really deserve it!

  • @sunmit_productions
    @sunmit_productions 4 роки тому +2

    Thank you very much Alex! I was struggling with HashMap for all day, and your video really helped!!

  • @fakejake8723
    @fakejake8723 3 роки тому

    Seriously you taught a semestre worth of studies under 20 min. I thank you. I couldn't figure this out until your video. Please make more videos on data structures. I get your explanations.

  • @darthpepe6761
    @darthpepe6761 4 роки тому +1

    I was working on a master order assignment where we had to make a map of cookie variety and its numBoxes sold. This video was very helpful since he basically said, here is the assignment. You're gonna need to know Maps. I appreciate the tutorials. Thank you so much.

  • @h0tar
    @h0tar 4 роки тому +1

    That keyboard is amazing! Thanks for clearing up hashmaps for me, makes it easier when we get there at school.

  • @saxkMr
    @saxkMr 2 роки тому

    now that's amazing how something so abstract to me has become instantly crystal clear. you are awesome!

  • @ahmediqbal9869
    @ahmediqbal9869 2 роки тому +5

    for anyone that is wondering, it is called a HashMap because it uses a technique called hashing.

  • @GuitaristEliKing
    @GuitaristEliKing 4 роки тому +1

    Couldnt imagine a better tutorial out there!
    Great Video man!

  • @sangeethamnair1395
    @sangeethamnair1395 2 роки тому

    In a technical aptitude exams hashing question were asked ..had no idea what hashing was and didn't do well but now it is crisp and clear thanks to u Sir..

  • @danishuddin9752
    @danishuddin9752 Рік тому

    The UI you created it beautiful!

  • @kzfingerprint
    @kzfingerprint 3 роки тому +1

    Your videos are amazing! Thank you!!! You break down complex things so that I can better understand what's actually going on

  • @mtm6613
    @mtm6613 Рік тому

    This was extremely helpful in helping me understand hashmaps. I wasn't understanding them in lectures but this definitely helped clear things up. Thanks!!!

  • @yogeshpandey9549
    @yogeshpandey9549 3 роки тому

    the most simplified yet extremely informative tut on hashmap. great work m8 :)

  • @bieberfever161098
    @bieberfever161098 3 роки тому +1

    I finally understood, thanks for the video!! Btw the sound of your keyboard is so satisfying😨

  • @abdullahmamun1823
    @abdullahmamun1823 3 роки тому

    just as simple as u.thanks.it is a one kind of social work.we need people like u.

  • @SuhasGowda4695
    @SuhasGowda4695 4 роки тому +3

    Thank you for the video. This covers almost everything for novice learners.

  • @biscuitbutb4106
    @biscuitbutb4106 2 роки тому

    These tutorials are awesome. You make java look so easy. Thanks for these easy tutorials!!

  • @thischannelisnomore1283
    @thischannelisnomore1283 4 роки тому +10

    Most useful on teaching me hashmaps, Thank you so much!

  • @preetamackermann3038
    @preetamackermann3038 2 роки тому +2

    You make everything so simple. Thanks a lot !

  • @baotang5776
    @baotang5776 2 роки тому

    I wonder how many people, beside me, who graduated IT thanks to you and John. I appreciate you.

  • @miriamarelymartinezcampos238
    @miriamarelymartinezcampos238 Рік тому +1

    I loved the names haha "happy" and "fun", thank you so much for your explanation you made easier to understand

  • @biggie2123
    @biggie2123 2 роки тому

    I finally understand HashMaps. Thank you so much!

  • @rolfchristensen9026
    @rolfchristensen9026 2 роки тому

    As usual GREAT! Understanding the concept in 11 minutes :)

  • @alexrogers7666
    @alexrogers7666 3 роки тому

    Thanks for taking time to create content that helps me understand Java! Great job!

  • @missakhaladjian
    @missakhaladjian 4 роки тому

    Thank you for these easy-to-understand tutorials, subscribed now!!

  • @mzamomahaeng268
    @mzamomahaeng268 2 роки тому

    You simplified it perfectly.. thank you sir

  • @razorlea1
    @razorlea1 2 роки тому +1

    You do a great job! Simple and clear! Thank you.

  • @mugdhashrivastava
    @mugdhashrivastava Рік тому

    love the teachers who make understanding fun. thank you sir

  • @abhi.marc90
    @abhi.marc90 2 роки тому

    Wow thank you I was unable to understand hash maps until I stumbled upon your video. Thank you :)

  • @RicardoPires2023
    @RicardoPires2023 4 роки тому +2

    Hello Alex and thank you very much for your videos. They are awesome!
    For this video in particular, it was not clear to me what are the differences of HashMap and ArrayList, and how too choose which to use.
    Thank you again!

  • @aishwarya6123
    @aishwarya6123 3 роки тому

    I definitely recommend Alex's video! Easy to understand and follow!

  • @supriyagupta922
    @supriyagupta922 3 роки тому +1

    lovely dialogue delivering, excellent quality of video, concepts told in lay man terms. enjoyed and learnt. keep up the good work Alex. :)

  • @mdhossain529
    @mdhossain529 4 роки тому

    You are great my son. May God Bless you.I am 48 but steel I am your student. Thank you very much.

  • @user-ts8dd7zc1n
    @user-ts8dd7zc1n Рік тому

    your explanations are the best! thank you so much!

  • @heksqer1022
    @heksqer1022 5 років тому +1

    Your videos are very easy to follow !

  • @Danni-8890
    @Danni-8890 3 роки тому

    You definitely helped me out! Thanks

  • @lainenainen
    @lainenainen Рік тому

    This was really helpful. Thank you so much!

  • @gavidhariwal6307
    @gavidhariwal6307 3 роки тому

    You're awesome dude! Very nice and concise explanations!

  • @AyshaBlogsStuff
    @AyshaBlogsStuff 3 роки тому

    Thank you! this was so clear

  • @mflr121
    @mflr121 3 роки тому +1

    Excellent video, I understood everything. Thank you!

  • @ritikaarya1904
    @ritikaarya1904 3 роки тому

    So simple explanation. Thanks!

  • @basithtafadher8743
    @basithtafadher8743 3 роки тому

    Teaching method really awesome. Wish your good health.

  • @arcane5837
    @arcane5837 2 роки тому

    Helped out at lot! Very concise!

  • @wattsofnoise
    @wattsofnoise 2 роки тому

    Thank you for making this. It was extremely helpful!

  • @usertyfoon
    @usertyfoon Рік тому

    That was great! Many thanks, bro!

  • @mageshsankaran6521
    @mageshsankaran6521 3 роки тому

    you explained it effortless

  • @adultishgambino8713
    @adultishgambino8713 4 роки тому

    Such a good tutorial, straightforward and useful

  • @fabianmaisch2423
    @fabianmaisch2423 3 роки тому

    Very nice man! Helped me a lot👍🏼

  • @ThePlugChannel2
    @ThePlugChannel2 6 місяців тому

    Bro say it’s confusing to him but now I just learn the concept in most simple way. Thank you bro 😂

  • @EypsSkWeEm
    @EypsSkWeEm 4 роки тому

    UNDERSTANDABLE !!! Very good video ! Your explanation is clear and simple ! Good job ! I like it.

  • @sehse100
    @sehse100 3 роки тому

    Wow!
    You made it easy for me!
    Thank you so much! ❤️❤️

  • @johncsanchez9763
    @johncsanchez9763 4 роки тому +2

    great tutorial. I understand it alot than my teacher. Thanyou! post more java tutorial

  • @danielmwinzi9223
    @danielmwinzi9223 2 роки тому

    You are the best 🙂 simple and clear without complications 👏👏

  • @jong.4864
    @jong.4864 4 роки тому

    This helped me a lot, thank you Alex!

  • @piyush99991
    @piyush99991 Рік тому

    Thanks a bunch for the tutorials man, appreciate it

  • @anugoudvoddepally348
    @anugoudvoddepally348 2 роки тому

    really ur explaination was good, after watching video i got clear idea about hash map thank you.

  • @nobel978
    @nobel978 4 роки тому +5

    Thank you so much, you're an awesome teacher.

  • @MsVasisth
    @MsVasisth 3 роки тому

    you don't give weird analogies like other youtube videos good work

  • @geromemanicia3809
    @geromemanicia3809 4 роки тому

    This was most helpful. I also want one of your keyboards but for now I'm gonna stay with my measly CTRL from drop.

  • @testtester5693
    @testtester5693 2 роки тому

    Thanks dude! Really good !!

  • @cacmang42
    @cacmang42 4 роки тому +1

    you're a great teacher, keep going 💪

  • @keynoism
    @keynoism 3 роки тому

    Thank you so much - I've been struggling with this for almost a week unable to get my code to work

  • @priyankadutta8798
    @priyankadutta8798 4 роки тому

    Wow ...such an amazing explanation

  • @thiagosilvafarias1893
    @thiagosilvafarias1893 4 роки тому

    Thank Alex, very clear explanation of HashMap.

  • @veriidiite.wav1
    @veriidiite.wav1 3 роки тому

    Legend

  • @soehtetaung3843
    @soehtetaung3843 Рік тому

    that's just straight as an arrow. Awesome bro.

  • @moadmerroun3333
    @moadmerroun3333 2 роки тому

    Great Tutorial 😀 Thanks a lot !

  • @tarunmathur7797
    @tarunmathur7797 4 роки тому

    Thanks man, you made it super easy

  • @nyxielia
    @nyxielia 4 роки тому +1

    Thank you so much!! Finally a good explanation! Can you please make more videos on Data Structures :-)

  • @shirinall9080
    @shirinall9080 2 роки тому

    This young dude is my favorite tutor in youtube !!

  • @chenzhu445
    @chenzhu445 4 роки тому

    Thank you Alex!! it's always fun and helpful watching your videos :) keep it up!

  • @KD_Panwar
    @KD_Panwar 2 роки тому

    pls make a full session on java , your style is best .

  • @roshankapoor9349
    @roshankapoor9349 3 роки тому

    Very clear explanation 👍 thanks 😀

  • @gary7135
    @gary7135 3 роки тому

    Gosh I wish I could watch ur vid earlier! I just love the way you teach, clear and understandable. PLZ UPLOAD MORE! LUV YA ♥

  • @JJ-pn8lb
    @JJ-pn8lb 3 роки тому

    Really easy to understand, best tutorial! :)

  • @antoalex5732
    @antoalex5732 3 роки тому

    Ivbeen stressing out over this for days cuz of my final. Learned it conpletely under 12 min just now. Just need some practice and the final is gonna be ez. thanks bud!

  • @psalkin
    @psalkin 2 роки тому

    Best hashmap tutorial ever!

  • @hamzabahamdan7057
    @hamzabahamdan7057 2 роки тому

    Your tutorials are awesome :D

  • @princeabdul4290
    @princeabdul4290 Рік тому

    Your Videos are straight to the point , My Coding phobia isn't anymore because of your videos...

  • @SS-ug1qy
    @SS-ug1qy 4 роки тому

    My favorite java tutor. if I am not mistaking if u want order you can use TreeMap

  • @andreloureiro4447
    @andreloureiro4447 4 роки тому

    Simply and great, thanks

  • @Jigmet8
    @Jigmet8 3 роки тому +1

    Hey Alex you're amazing I really love the way you teach...Stay happy 😉

  • @Rohan122
    @Rohan122 3 роки тому

    Beautifully explained.😄

  • @jasper5016
    @jasper5016 3 роки тому

    Great tutorial Alex.

  • @JEAPI_DEV
    @JEAPI_DEV Рік тому

    Thx , nice explanation btw keep up the good work 👍

  • @johnvishwas9117
    @johnvishwas9117 3 роки тому

    You're the best coding tutor!