14.11 HashMap and HashTable in Java
HTML-код
- Опубликовано: 17 апр 2016
- Check out our courses:
Spring and Microservices Weekend Live Batch : bit.ly/spring-live-weekend
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : bit.ly/java-spring-cloud
For More Queries WhatsApp or Call on : +919008963671
website : courses.telusko.com/
Instagram : / navinreddyofficial
Linkedin : / navinreddy20
TELUSKO Android App : bit.ly/TeluskoApp
Discord : / discord
Complete Java Tutorial : goo.gl/3NaAW1
HashMap and HashTable both implements Map interface.
HashTable is synchronized and HashMap is not synchronized.
HashMap is faster than HashTable.
HashMap, LinkedHashMap, TreeHashMap, HashTable implements Map Interface
Recommend Books :
1. Head First Java : amzn.to/2owFrf0
2. Java Complete Reference : amzn.to/2osY04k
Java and Spring Framework For beginners with Spring Boot : - bit.ly/3LDMj8D
Java Tutorial for Beginners (2023) :- bit.ly/3yARVbN
Editing Monitors :
amzn.to/2RfKWgL
amzn.to/2Q665JW
amzn.to/2OUP21a.
Editing Laptop :
ASUS ROG Strix - (new version) amzn.to/2RhumwO
Camera : amzn.to/2OR56AV
lens : amzn.to/2JihtQo
Mics
amzn.to/2RlIe9F
amzn.to/2yDkx5F
Subscribe to our other channel:
Navin Reddy : / @navinreddy
Telusko Hindi :
/ @teluskohindi
Subscribe to the channel and learn Programming in easy way.
Java Tutorial for Beginners : goo.gl/p10QfB
Scala Tutorials for Java Developers : goo.gl/8H1aE5
C Tutorial Playlist : goo.gl/8v92pu
Android Tutorial for Beginners Playlist : goo.gl/MzlIUJ
XML Tutorial : goo.gl/Eo79do
Design Patterns in Java : goo.gl/Kd2MWE
Socket Programming in Java : goo.gl/jlMEbg
Spring MVC Tutorial : goo.gl/9ubbG2
OpenShift Tutorial for Beginners : goo.gl/s58BQH
Spring Framework with Maven : goo.gl/MaEluO
Sql Tutorial for Beginners : goo.gl/x3PrTg
String Handling in Java : goo.gl/zUdPwa
Array in Java : goo.gl/uXTaUy
Java Servlet : goo.gl/R5nHp8
Exception Handling in Java : goo.gl/N4NbAW
Great going sir! I tend to first search your channel for things I am looking for before looking elsewhere. Keep up the great work, sir.
Incredibly helpful video! Super clear and concise :)
3:05 HashMap, LinkedHashMap, TreeHashMap, HashTable implements Map Interface
4:55 "keySet" method
5:31 "Map.Entry(I) and "entrySet" method
7:59 LinkedHashMap, TreeHashMap vs HashMap
Hai
Visit my hash map video
That's one of the best tutorials i've ever watched
very helpful, thank you for the effort you've put into these videos
Awesome videos, learning Java thru ur videos is a breeze. Small clarification - HashTable is synchronized and shouldn't it be a single thread instead of multiple threads.
Thank you so much for such partical and to the point explanation.
Thank you so much over again.
Great job as always !!!!
This is the best tutorial in entire internet. Thanks for the effort.
Hello
Visit my hash map video
the way you teach is really awesome :) very nice work.
Hi navin, good job....keep up the great work...can you please make a video on internal working of map in Java.
Hey when are you planning to upload the next video to this playlist? So far it was very good and helpful and we are waiting for more videos on collection playlist.
7 years ago u were learning collections just wanna ask how's ur programming going..?
You da best... very well explained.
You make it look so simple!!! Thank you very much sir.
🙏
After scanning through a ton of implementations this has to be one of the most concise video on this topic.
You made me understand man
thank you SIR
Very good explanation. Thank you
sir,is there any way to input the entries at once into a hashmap rather than using put() function for very entry ?Also is there any way to see a particular value, and not all the value in the map.
T
hanks boss for the simple clarifications ............
you are the best man god bless you
in Map.entry , entry is inner class of interface map
Very clear explanation, sir! Great Job! Like + Subscription.
Navin, you look so much better now, your English has improved and you explain better, Its amazing seeing how much you have improved
It's a 5 years old video, he's now the knowledge source for crores of developers. Please mind before commenting.
Thank you Sirji !!
Awesome video :)
We can iterate directly also on entry set rather than saving first in Set.
for(Map.Entry i : map.entrySet()) {
System.out.println(i.getKey()+" " + i.getValue());
}
yes you can, he was just making it simpler to every one like if you have map.entrySet() then it can be assign to Set. Also we all can save variable , it was done here for readability
Amazingly informative video.
Excellent example to make it explained.
Thank you for the tutorial, am using jdk 8, it doesn't support these data structures :hashtable,hashmap...what should i do?
nice explanation.Thanks for information......
Thank you! Very helpful tutorial
very helpful,Amazing explain. thank you
I've seen many tutorial of a Java but this is the best one, sir why don't u start pega software tool?? It is also based on Java,
if the keyset is one way of getting all the key value pairs then is there any reason to use the other way of map.entry? If the end result is to get all the key value pairs without individually knowing each key, then what is the need of the map.entry method, and why would they want to ask about that in an interview.
"If you know the key, you will get the number". Well I got arrested instead.
😂
Do you have video about hashtable implementations/functions? (like your videos of linkedlists,ques,stacks)
I
One thing is wrong here,in hash map multiple threads will work at a time where as in hash table only single thread at a time( you did a mistake in comparison table )
this video give very good information about haaaaaaashmap
in your phone book example if i want to have duplicate name then what should be the right way to implement key value pair?
Duplicate keys are not allowed
Thanks for information. What if we have more than two columns in excel, how to store such values?
thank you very much sir for this video
Great explanation, very useful
Great tutorial sir
finally my map concept clear thankyou sir :)
Thank you so much for this Navin
Love telusko since 2019
At 4:04 What would be the output if we execute System.out.println(phonebook.values()).. Will it be sorted if yes then on what basis .. Please explain .Thanks in Advance
How to print whole key set? - 4:54
What is entry set and how to print it? - 5:31
so...for storing key-value pairs, we could very well use Arrays, by storing keys as indices and values as the Array Values. What is so specific about HashMaps?
The way of explanation is very crystal clear and understandable
Nice, how to get the length of value of a perticuler key?
amazing explanation. thank you so much sir
thank you.
it was direct in the point .. learned quickly thnx.
Very clear explanation.. superb.. thank u so much sir.. ur videos are easy to understand even if it is a big thing..
today I learned a new concept
I like your channels name...innovative!
Lot's of thanks dear sir, Awesome videos, learning Java videos is a amazing. Perfect clarification - HashTable is synchronized and shouldn't it be a single thread instead of multiple threads.👍👍👍👍👍👍
thank u so much
you have some tutorials regarding concurrent collections
Is it possible to have a multiple attributes instead of just 1 key to 1 value like a CSV? eg
Name, age, weight
Bill, 18, 60
hi sir i am big fan of you,sir can you make a video on what is difference between Hashcode and equals method in collection
Nice video ..could you please give an example of hashmap under hashmap
can we give more than one value to a single key ? any method to do that ?
Thx for the valuable information
Can anyone tell me, what is this sign ? Is it a paramerter or what?
super video. thank you :)
Hello. Thanks for the awesome tutos. Is there a difference between: Entry and Map.Entry?
Hai
Visit my hash map video
Hello sir what is the meaning of this line please help (although it is not related to this video) : HashSet hs=new HashMap();
Nice video . Thanks for very useful information
Sir,the video really very helpful...I have a doubt...is it possible to map HashMap....
can you please tell me,why in hashtable ,no null key is allowed?
Thank you 👍
Whatever you have explained that is perfectly fine but I have another doubt which is related to memory leak. When we don't implement the equals and hashcode then it takes from object class in that case too it gives us some unique code, So how GC is unable to clean up those unused objects when "get" method called internally then it definitely returns its hashcode and that is a expected case. But this whole scenario is a memory leak problem so please explain this.
hello sir, I have a small doubt which is asked by my friend.how can we create an object of HashSet with the help of object of ArrayList. please give me the correct solution.
ConcurrentHashmap
?
Because of you I got placed in compan.thankyou so much
what is the use of e.setvalue("III")
YOU ARE AMAZING AS ALWAYS ^_^
Good one sir
good thanks sir
Fantastic
Hi, Ive got this assement for the college:
I have to implement a system for viewing and updating of student data. This data is giving by a .txt,
for example:
201504123|Carla Arias|IN-TEL|20|10|2|6.8
201402947|Paul Zambrano|IN-TLM|21|18|0|8.1
201508364||||||
201502342|Ivan Torres|IN-CC-ST|19|6|0|7.5
201201723||||||,
my question is:
Which method is better to implement this, hashmap or hashtable?
I have one problem how to add 2 friend have same name but in Java we cannot use one key two time then how to implement the phone book in Java we use two value at a time but not key
Thank you sir
Its was tough to understand especially entry,but though thank u
thank u telusko sir
--regards from an alien
some people must love when sir calls us aliens, i guess
Hello sir do you have video on arraylist?
Naveen, How will we fetch all key and its values using old for loop ? i am trying but not able to do it with normal for loop ? could u please help..
Tq sir..
help me alot to clear concept thank you
\
I'm only 10 but its still very good and I can still understand, I'm trying to create a game and this tutorials has helped a lot
Learn unity or gamemaker
@@cutevideos9571 if one wants to shine in making games he has to grab programming early on, focusing on other aspects will slow him down because objects of unity deal with inheritance and objects. Learning codes should be the first thing any wanna be game Dev should start with. No only will you have knowledge about implementing your features but also step up the ladder quicker because all you need to get used to us the engine library and 3d art works and how they work. Learn coding first mate trust me.
One more Difference
.........................................
HashMap allows "Null Values"....whereas....HashTable doesn't allow "Null Values"....
............................
One Correction
...........................
.......The Methods of both Objects work with Multiple Threads......
Hi to all of you.. I have a question.. if I want to do a program to check and keep updating student data..
something like:
1 see data
2 find student data
3 exit
for that... what do you think I have to use..hashtable or hashMap?
If your application is multithreaded go for hashtable or use hashmap
Wonderful
Sir, suppose I want to sort String keys according to its length, how do I do it!
private static void mapKeSortByLength() {
Map testMap = new HashMap();
testMap.put("aaa", "333");
testMap.put("aaaaa", "55555");
testMap.put("aaaa", "4444");
testMap.put("aa", "22");
testMap.put("a", "1");
Set allKeys= testMap.keySet();
List listKeys = new ArrayList();
for(String k : allKeys) {
listKeys.add(k);
}
Collections.sort(listKeys, Comparator.comparing(String::length));
System.out.println(listKeys);
}
Difference between HashMap & HashTable 6:46
could you pls explain how to add list into hashmap !!!! and as well as how to add the hashmap inside the hashmap???
can you plz send me the link of the next practicle video
thank u da mota thala