Java HashMap 🗺️

Поділитися
Вставка
  • Опубліковано 10 січ 2025

КОМЕНТАРІ • 171

  • @BroCodez
    @BroCodez  4 роки тому +83

    import java.util.HashMap;
    public class Main {
    public static void main(String[] args) {
    // HashMap implements the Map interface (need import)
    // HashMap is similar to ArrayList, but with key-value pairs
    // stores objects, need to use Wrapper Class
    // ex: (name,email),(username,userID),(country,capital)

    HashMap countries = new HashMap();

    //add a key and value
    countries.put("USA","Washington DC");
    countries.put("India","New Delhi");
    countries.put("Russia","Moscow");
    countries.put("China","Beijing");

    //System.out.println(countries);
    //countries.remove("USA");
    //System.out.println(countries.get("Russia"));
    //countries.clear();
    //System.out.println(countries.size());
    //countries.replace("USA", "Detroit");
    //System.out.print(countries.containsKey("England"));
    //System.out.print(countries.containsValue("Beijing"));

    for(String i : countries.keySet()) {
    System.out.print(i+"\t"+"= ");
    System.out.println(countries.get(i));
    }

    }
    }

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

      thank you for sharing the code in the comments. saves a lot of pausing and rewinding :)

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

      Bro can you make hash table stuff please..

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

      Instablaster

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

      Yeah you have done correctly no mistake
      Keep it up😊😊😊

    • @salahSaad-ld8id
      @salahSaad-ld8id 11 місяців тому

      Thanks for really amazing video it's really helpful

  • @kayleighrenner829
    @kayleighrenner829 2 роки тому +18

    Your short and clear explanations helped me a lot! Thank you

  • @britneyhanna6667
    @britneyhanna6667 4 роки тому +19

    Clear explanation as always bro. Thank you this helped me with my assignment.

  • @IdoH-vf2yc
    @IdoH-vf2yc Рік тому +13

    Hi Bro, hope you're doing well
    Your videos and explanations about Java and many other programming languages you have on the channel are excellent, understandable and very helpful.
    You make a complicated subject much simpler.
    I was wondering if you could add to the playlist, videos that explain the interfaces: List, Set, Map.
    And an explanation of their implementers: HashSet, HashMap, TreeMap, TreeSet, SortedMap, SortedSet, etc.

  • @chetranqui
    @chetranqui 3 роки тому +12

    Clear, succinct, and complete. Thank you for that.

  • @mctinemacrisp3120
    @mctinemacrisp3120 3 роки тому +3

    Love from Germany

  • @vpaulino15
    @vpaulino15 9 місяців тому

    One thing that always confuse me more is long explanations, I really appreciate how you make this simple and straightforward

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

    At 11:11, why does it not list the hashmap in the same order in which it was created? As always, great video. I started at video number 3 and this is number 76. Plan to do them all. Not just watching, but I'm doing them myself. Loving it. Your consistency in how you explain is remarkable.

  • @sarthakoberoimusic
    @sarthakoberoimusic Рік тому +23

    a comment for the sake of defeating the algorithm.

  • @hermitmobile1742
    @hermitmobile1742 3 роки тому +17

    Every time I watch these videos I am reminded that going to school is overrated … if only my teachers are this clear🤧🤧🤧

  • @honkhonkv2236
    @honkhonkv2236 10 місяців тому +1

    When i first heard about Sets and Maps i always thought i'd never use those but they are, in fact, actually easier than actual arrays, i'm kinda mind blown.

  • @rimarai7898
    @rimarai7898 8 місяців тому

    I have been studying Java for 6 months, and my university, as much as the lectures try to help, is absolutely useless, especially for someone like me who suffers from learning disabilities, but your videos are amazing... I wish I found it sooner. They teach me things and help me understand in 1-3 days compared to a month and only half understanding it through my university. Thank you so much! I am been acing my tests with your tutorials xd.

  • @sergeyb6071
    @sergeyb6071 4 роки тому +8

    very happy to see new java tutorials Bro!

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

      I'll be updating this playlist more often. It seems there's a big demand for Java

    • @user-xe8vl9eh9l
      @user-xe8vl9eh9l 3 роки тому +2

      @@BroCodez theres a big demand for knowledge in the world because most of them cant afford it and want to find free ways to learn .thank you so much for ur videos

  • @justinbanza4751
    @justinbanza4751 3 роки тому +3

    Thank you for this video.
    Very clear and straight forward

  • @lamias7712
    @lamias7712 3 роки тому +3

    I like your time traveling, :D. Thanks for the videos

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

    Easy and smooth as always
    Thanks a lot bro

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

    That was what I really need to understand! Hashmap in java!

  • @huyoan1677
    @huyoan1677 4 місяці тому

    THANK YOU VERY MUCH. YOUR VIDEOS WERE REALLY USEFUL FOR BEGINNERS LIKE ME. Once again, thanks, Bro.

  • @bullymaguire5838
    @bullymaguire5838 10 днів тому

    Thanks bro you made learning code fun. ❤
    I don't even have python as a subject but started anyway because I'm having fun

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

    Thank you. Your videos deserve way more atention!

  • @IDK-kv8ob
    @IDK-kv8ob Рік тому

    3:39 the diamond operator at the end of the instantiation does not need to take in the String values. Java infers the type from the first portion! Hey, I actually know something about Java. Feels good.

  • @greenrocket23
    @greenrocket23 4 місяці тому

    I always learn something new from your videos, thank you!

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

    You make coding easy even though I'm mostly learning in theory and writing on pen and paper

  • @CarlAngeloAntenor
    @CarlAngeloAntenor 3 роки тому +3

    me: Searches how to make a hashmap and clicks on a vid
    also me: *INSTANTLY CLICKS ON ANOTHER HASHMAP VID CAUSE ITS BRO CODE*

  • @milo-ur8zp
    @milo-ur8zp 4 роки тому +4

    thanks a lot man, crystal clear explanations

  • @mohtasimhossain3741
    @mohtasimhossain3741 9 місяців тому +1

    Bro is a hero❤❤

  • @sureshponna3405
    @sureshponna3405 10 місяців тому

    Tqs for cleaning my mind with HashMap doughts😊😊

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

    Great video. Thanks bro

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

    Good one...simple and easy explanation...thank you bro 🙂

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

    Allways perfact explanation❤

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

    It's an Arraylist with objects as indecies.

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

    really easy. thanks for goos explanation.

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

    Thank you so much for the easily understandable explanation!

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

    So simple 👌

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

    Great video.

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

    Nice video

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

    Love From India😁😁😁😁

  • @eagle1341
    @eagle1341 9 місяців тому +2

    Have you ever eaten grass? Because you are the GOAT! :)

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

    Great

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

    wonderfull

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

    bro this is awesome wou put things down so concisely

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

    Hello is there a playlist for hash map , linked list , stack , Queue ? Thanks for your time.

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

    Bravo 👏

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

    Thank you for all your efforts

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

    Nice

  • @Александр-т5з6ы
    @Александр-т5з6ы 2 роки тому

    Nice time-travel 🙂

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

    Burger -> Patty
    Pizza -> Cheese
    Chapati -> Wheat
    Spring Roll -> BBQ

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

    Outstanding bro sir

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

    the best coding youtuber

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

    Great Job!

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

    Great explanation

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

    How do you check if a key value pair exists in the hashmap?
    I.e if capital of India is new Delhi?

  • @mohammedzaidkhan5687
    @mohammedzaidkhan5687 4 місяці тому

    nice

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

    could you make course of dsa which you implement code manually

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

    Keep it up

  • @rukiruki-eg4kc
    @rukiruki-eg4kc Рік тому

    I too, think about Hashbrowns alot.

  • @keler50213
    @keler50213 12 днів тому

    awesome~

  • @РаильРавилов-т9п
    @РаильРавилов-т9п 2 роки тому

    I took tree speps I smashed the butten, subscribed and yes I`d like to become a fello bro ;)

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

    really really nice!

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

    OUR BRO CAN TIME TRAVEL!!!

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

    ❤️From India.

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

    Can you do a video about Treemap ?

  • @samanthamonroe264
    @samanthamonroe264 2 місяці тому

    Carried me through my comp si exam

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

    you make it too easy to understand

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

    godly explanation.

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

    Thank you

  • @arrheniusmbakz6160
    @arrheniusmbakz6160 11 місяців тому

    You're the best Bro

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

    Thank you bro!!!

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

    Nice, bro!

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

    I have made another variant:
    Map countries = new HashMap();
    countries.put("USA","Washington DC");
    countries.put("India","New Delhi");
    countries.put("China","Beijing");
    for (Map.Entry sentry: countries.entrySet()) {
    System.out.printf("The capital of %s is %s
    ", sentry.getKey(), sentry.getValue());
    }
    I think its elegant, cause we receive key and value in-place within Map.Entry instead of "key-before, value-then" principle.

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

    5:49 This aged well.

  • @Ahmad-td4ck
    @Ahmad-td4ck 3 роки тому +1

    Thanks bro

  • @antoinealam6531
    @antoinealam6531 3 місяці тому

    Cheers bro

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

    time travelling ,
    Hey guys its bro from the future.

  • @Akshaycleanvoice
    @Akshaycleanvoice 2 місяці тому

    Thanks bro 😊😊

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

    this was great

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

    I LOVE THIS!

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

    Thanx

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

    There are too many things need to understand, such as collections , list, especially Linkedlist, it is abstract. And tree map. I don’t understand what is tree map. In Chinese they say a word 红黑树 , which means red and black tree style to store hash code.

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

      I wonder why it's called "red and black tree". That is an interesting translation

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

      Bro Code I think he wants a video of a Red-Black tree with code.

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

      Bro Code because if you use different color to mark a tree map, it will be more easy to find a certain hash code I think. For example base level is black, and second level is red, and third level is black. But I am also don’t know, why it is called black and red tree.

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

      Calibre Yes! It is red-black tree. Sorry.

  • @MrLoser-ks2xn
    @MrLoser-ks2xn 2 роки тому

    Thanks

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

    time to go back to the present

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

    💪

  • @Akshaycleanvoice
    @Akshaycleanvoice 2 місяці тому

    Thanks bro 😁

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

    Thanks bro🙂

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

    brooo why do u use da eclipse, intellij is the alpha bro tool

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

    I Helped You.... 😊

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

    Thank You bro

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

    Good thing future bro popped in, I was confused AF and doubting myself.

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

    what is with the music behind

  • @JohnJohn-sj2ge
    @JohnJohn-sj2ge Місяць тому

    Middleweight = Dricus Du Plessis
    Lightweight = Islam Makhachev
    Welterweight = Belal Muhammed
    Featherweight = Ilia Topuria
    ur a legend

  • @kristijanlazarev
    @kristijanlazarev 10 місяців тому

    Very good, could just write everything in a sout statement, so that we dont waste time talking about how it wont do anything unless we pritn

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

    😎💪🏾💪🏾

  • @bharath._.07-yt
    @bharath._.07-yt 8 місяців тому

    Broo what about HashSet???

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

    thanks bro!

  • @dogukan-u2n
    @dogukan-u2n Рік тому

    Turkiye = Ankara
    China = Beijing
    Turk = Samsun
    Russia = Moscow
    India = New Delhi

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

    love you bro

  • @leviplays7466
    @leviplays7466 9 місяців тому

    you're the bro

  • @ShreyasHoley
    @ShreyasHoley 2 місяці тому

    okay sir

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

    8:50 imagine if the USA’s capita was Detroit 😂

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

    i need to learn how to combine hashsets and int ch = sc.jscnext()