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");
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.
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.
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.
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.
@@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
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.
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.
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.
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.
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));
}
}
}
thank you for sharing the code in the comments. saves a lot of pausing and rewinding :)
Bro can you make hash table stuff please..
Instablaster
Yeah you have done correctly no mistake
Keep it up😊😊😊
Thanks for really amazing video it's really helpful
Your short and clear explanations helped me a lot! Thank you
Clear explanation as always bro. Thank you this helped me with my assignment.
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.
Clear, succinct, and complete. Thank you for that.
succ int
Love from Germany
One thing that always confuse me more is long explanations, I really appreciate how you make this simple and straightforward
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.
a comment for the sake of defeating the algorithm.
Every time I watch these videos I am reminded that going to school is overrated … if only my teachers are this clear🤧🤧🤧
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.
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.
very happy to see new java tutorials Bro!
I'll be updating this playlist more often. It seems there's a big demand for Java
@@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
Thank you for this video.
Very clear and straight forward
I like your time traveling, :D. Thanks for the videos
Easy and smooth as always
Thanks a lot bro
That was what I really need to understand! Hashmap in java!
THANK YOU VERY MUCH. YOUR VIDEOS WERE REALLY USEFUL FOR BEGINNERS LIKE ME. Once again, thanks, Bro.
Thanks bro you made learning code fun. ❤
I don't even have python as a subject but started anyway because I'm having fun
Thank you. Your videos deserve way more atention!
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.
I always learn something new from your videos, thank you!
You make coding easy even though I'm mostly learning in theory and writing on pen and paper
me: Searches how to make a hashmap and clicks on a vid
also me: *INSTANTLY CLICKS ON ANOTHER HASHMAP VID CAUSE ITS BRO CODE*
thanks a lot man, crystal clear explanations
Bro is a hero❤❤
Tqs for cleaning my mind with HashMap doughts😊😊
doubts*
Great video. Thanks bro
Good one...simple and easy explanation...thank you bro 🙂
Allways perfact explanation❤
It's an Arraylist with objects as indecies.
really easy. thanks for goos explanation.
Thank you so much for the easily understandable explanation!
So simple 👌
Great video.
Nice video
Love From India😁😁😁😁
Have you ever eaten grass? Because you are the GOAT! :)
Great
wonderfull
bro this is awesome wou put things down so concisely
Hello is there a playlist for hash map , linked list , stack , Queue ? Thanks for your time.
Bravo 👏
Thank you for all your efforts
Nice
Nice time-travel 🙂
Burger -> Patty
Pizza -> Cheese
Chapati -> Wheat
Spring Roll -> BBQ
Outstanding bro sir
the best coding youtuber
Great Job!
Great explanation
How do you check if a key value pair exists in the hashmap?
I.e if capital of India is new Delhi?
nice
could you make course of dsa which you implement code manually
Keep it up
Yea!!
I too, think about Hashbrowns alot.
awesome~
I took tree speps I smashed the butten, subscribed and yes I`d like to become a fello bro ;)
really really nice!
OUR BRO CAN TIME TRAVEL!!!
❤️From India.
Can you do a video about Treemap ?
Carried me through my comp si exam
you make it too easy to understand
godly explanation.
Thank you
You're the best Bro
Thank you bro!!!
Nice, bro!
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.
5:49 This aged well.
Thanks bro
Cheers bro
time travelling ,
Hey guys its bro from the future.
Thanks bro 😊😊
this was great
I LOVE THIS!
Thanx
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.
I wonder why it's called "red and black tree". That is an interesting translation
Bro Code I think he wants a video of a Red-Black tree with code.
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.
Calibre Yes! It is red-black tree. Sorry.
Thanks
time to go back to the present
💪
Thanks bro 😁
Thanks bro🙂
brooo why do u use da eclipse, intellij is the alpha bro tool
I Helped You.... 😊
Thank You bro
Good thing future bro popped in, I was confused AF and doubting myself.
what is with the music behind
Middleweight = Dricus Du Plessis
Lightweight = Islam Makhachev
Welterweight = Belal Muhammed
Featherweight = Ilia Topuria
ur a legend
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
😎💪🏾💪🏾
Broo what about HashSet???
thanks bro!
Turkiye = Ankara
China = Beijing
Turk = Samsun
Russia = Moscow
India = New Delhi
love you bro
you're the bro
okay sir
8:50 imagine if the USA’s capita was Detroit 😂
😹
i need to learn how to combine hashsets and int ch = sc.jscnext()