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.👍👍👍👍👍👍
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.
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
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 )
It is prefer to work with single thread in hashmap as it is not thread safe and if we work with multiple threads then inconsistency might occur. Whereas in hastable as it is synchronised u can go for multiple threads without worrying about inconsistency as it is synchronised. Jvm will take care of it, at a time only one thread will execute.
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.
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
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......
@@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.
Is HashMap working single thread? HashMap is unsynchronized right!.. so it's used multithreaded only, but you mention hashmap works with a single thread in the hashmap and hashtable difference.. if it is right you mentioned, please explain.
I think there is mistake in your slide u have written HashTable is Syncronised well Its true. but it should not access by multiple threads. synchronized mean only single thread can access at a single time. Please revert me if i am wrong.
when there are multiple threads in an application only we use synchronization to not to access particular block to all the threads simultaneously.so what he said is true.
Hashtable is synchronized then how it allows to work with multiple threads some people may ask this question so here i am clarifying the question...As per java synchronize internally lock and unlock method follows..when any single thread enters to process automatically it is surrounded by lock which wont allow other thread to process untill 1st thread process completed and lock release So it is good to use for multi-threading environment..
Idiot!!...Why we use Synchronization?? That is to deal with multiple threads in synchonized way i.e to allow only ONE thread instance at a time, that's why LOCKING is intoduced to achieve that motive. So you are SAFE while dealing with MULTIPLE threads in HASHTABLE, while in HASHMAP its not safe to deal with multiple threads as there is NO locking mechanism hence will land you to some inconsitent result. I hope you understood now. Please verify YOUR concepts before putting -ve comments. Thanks
Hai Idiot what are you doing from 8months ??...hahaha have you learned again hashmap and hashtable... Dont use low level language which i can use better than you...But your in respectable position so iam unable to do that..Plz control your words..
I am very sorry dude.!! Your words itself prooved your "IDIOT" Yes I am again learning HashMap and HashTable but I am DAMN sure I have better understanding than you...!! As per your freaking comments after 8months too it seems you didnt have a CLEAR concept and will also not have in future for SURE...!! Anyways I dont want to waste time with a senseless guy like you who!! You can only be better in low level language..!! (As mentioned by you only).
I already proved for my big clients for (India & US) government and pvt with High security webservices agile projects....Yes i'm an Idiot for short minded people...
LOL!!....Not understanding HashMap and provided high security bla bla bla.....!!You can just FART around and fill the env with your freaking smell !! Dont let me rip you out again and again!!
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.
What ??? Hashtable is synchronized but uses multiple threads and HashMap is unsynchronized but uses single thread.. How is this happening.. Seems there has been a mistake...
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?
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.
@@shabir301 If you only have 3 or 4 friends that works fine. If you are looking up thousands of numbers per minute out of millions and millions and millions of possible choices, HashMap will still be blazingly fast, and you will drag a whole CPU down if you try to do that with an array.
hello sir i have a doubt hashmap is not threadsafe so it is faster than hashtable but you mention hashmap works with only one thread by using only single thread how we can get faster performance. please explain me
Say, there is a bucket X and its capacity has reached TREEIFY_THRESHOLD i.e., 8, but MIN_TREEFIY_CAPACITY is not yet reached, say MIN_TREEFIY_CAPACITY is still 16. Then the Linked List structure in bucket X will not be converted to Balanced Binary Tree as MIN_TREEFIY_CAPACITY is not yet reached. Instead number of buckets is doubled. So now, our MIN_TREEFIY_CAPACITY becomes 16+16=32. Say now we again try to add a value to hashmap which hash's to bucket X, then will the bucket X continue to store the values in a Linked List fashion as MIN_TREEFIY_CAPACITY is still not reached ?
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?
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
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.
That's one of the best tutorials i've ever watched
This is the best tutorial in entire internet. Thanks for the effort.
Hello
Visit my hash map video
Incredibly helpful video! Super clear and concise :)
🙏
After scanning through a ton of implementations this has to be one of the most concise video on this topic.
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.
Because of you I got placed in compan.thankyou so much
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.👍👍👍👍👍👍
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.
The way of explanation is very crystal clear and understandable
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
Love telusko since 2019
Thank you so much for such partical and to the point explanation.
Thank you so much over again.
You make it look so simple!!! Thank you very much sir.
How to print whole key set? - 4:54
What is entry set and how to print it? - 5:31
Great explanation, very useful
Thank you so much for this Navin
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 )
It is prefer to work with single thread in hashmap as it is not thread safe and if we work with multiple threads then inconsistency might occur.
Whereas in hastable as it is synchronised u can go for multiple threads without worrying about inconsistency as it is synchronised. Jvm will take care of it, at a time only one thread will execute.
very helpful, thank you for the effort you've put into these videos
the way you teach is really awesome :) very nice work.
amazing explanation. thank you so much sir
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..?
Very clear explanation, sir! Great Job! Like + Subscription.
Nice video . Thanks for very useful information
You da best... very well explained.
"If you know the key, you will get the number". Well I got arrested instead.
😂
this is a great overview, thanks a lot!!
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..
Thx for the valuable information
finally my map concept clear thankyou sir :)
Amazingly informative video.
Hi navin, good job....keep up the great work...can you please make a video on internal working of map in Java.
You are the G.O.A.T
very helpful,Amazing explain. thank you
Thank you! Very helpful tutorial
thank u telusko sir
--regards from an alien
Excellent example to make it explained.
Very good explanation. Thank you
you are the best man god bless you
Great job as always !!!!
hardwork defines the sucess like the above example!!!!
One of the best explanation👏👏
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,
Awesome video :)
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
Difference between HashMap & HashTable 6:46
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......
nice explanation.Thanks for information......
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.
thank you very much sir for this video
Is HashMap working single thread? HashMap is unsynchronized right!.. so it's used multithreaded only, but you mention hashmap works with a single thread in the hashmap and hashtable difference.. if it is right you mentioned, please explain.
Great tutorial sir
T
hanks boss for the simple clarifications ............
5:52 why e.setValue is used?
in Map.entry , entry is inner class of interface map
Can anyone tell me, what is this sign ? Is it a paramerter or what?
Thank you sir
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..
You made me understand man
thank you SIR
Thank you Sirji !!
Hello sir what is the meaning of this line please help (although it is not related to this video) : HashSet hs=new HashMap();
this video give very good information about haaaaaaashmap
Do you have video about hashtable implementations/functions? (like your videos of linkedlists,ques,stacks)
I
great explanation!
Sir,the video really very helpful...I have a doubt...is it possible to map HashMap....
Great video.
Just one thing, there is no TreeHashMap in java docs instead there is TreeMap.
Good Catch
Hello
Visit my hash map video
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
I like your channels name...innovative!
Is there any class called TreeHashMap? I think it is TreeMap only right?
Good one sir
super video. thank you :)
I think there is mistake in your slide u have written HashTable is Syncronised well Its true. but it should not access by multiple threads. synchronized mean only single thread can access at a single time. Please revert me if i am wrong.
Yes u r absolutely correct...
exactly!!
when there are multiple threads in an application only we use synchronization to not to access particular block to all the threads simultaneously.so what he said is true.
pls first check the point prooperly then you can understand it/....in a synchronised method we can not execute multiple threads at a time...
Hashtable is synchronized then how it allows to work with multiple threads some people may ask this question so here i am clarifying the question...As per java synchronize internally lock and unlock method follows..when any single thread enters to process automatically it is surrounded by lock which wont allow other thread to process untill 1st thread process completed and lock release So it is good to use for multi-threading environment..
Idiot!!...Why we use Synchronization?? That is to deal with multiple threads in synchonized way i.e to allow only ONE thread instance at a time, that's why LOCKING is intoduced to achieve that motive. So you are SAFE while dealing with MULTIPLE threads in HASHTABLE, while in HASHMAP its not safe to deal with multiple threads as there is NO locking mechanism hence will land you to some inconsitent result. I hope you understood now.
Please verify YOUR concepts before putting -ve comments.
Thanks
Hai Idiot what are you doing from 8months ??...hahaha have you learned again hashmap and hashtable...
Dont use low level language which i can use better than you...But your in respectable position so iam unable to do that..Plz control your words..
I am very sorry dude.!! Your words itself prooved your "IDIOT"
Yes I am again learning HashMap and HashTable but I am DAMN sure I have better understanding than you...!! As per your freaking comments after 8months too it seems you didnt have a CLEAR concept and will also not have in future for SURE...!!
Anyways I dont want to waste time with a senseless guy like you who!!
You can only be better in low level language..!! (As mentioned by you only).
I already proved for my big clients for (India & US) government and pvt with High security webservices agile projects....Yes i'm an Idiot for short minded people...
LOL!!....Not understanding HashMap and provided high security bla bla bla.....!!You can just FART around and fill the env with your freaking smell !! Dont let me rip you out again and again!!
can you please tell me,why in hashtable ,no null key is allowed?
what is difference between map.keySet() and map.entrySet(),at what condition to use these things
good thanks sir
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.
Nice video ..could you please give an example of hashmap under hashmap
Can we not create an ArrayList of objects?
Sir can you please explain the algorithm for hashing. How it works internally in the next upcoming video.
That will never happen bro...i am sure..
@@abhishekmedha1098 why so brother
Hi
Visit my hash map video
What ??? Hashtable is synchronized but uses multiple threads and HashMap is unsynchronized but uses single thread.. How is this happening.. Seems there has been a mistake...
Thank you for the tutorial, am using jdk 8, it doesn't support these data structures :hashtable,hashmap...what should i do?
Fantastic
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
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
can we give more than one value to a single key ? any method to do that ?
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);
}
YOU ARE AMAZING AS ALWAYS ^_^
some people must love when sir calls us aliens, i guess
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.
There's nothing called Treehashmap, it's just tree map.
Even you got little confused while reading TreeMap----Hash----TreeHashMap, may be someone in your team would has prepared the visuals.
@@Telusko why we didn't gona use array class that contains two string to store name and contact it so easy as compare to hash map .....And flexible
@@shabir301 If you only have 3 or 4 friends that works fine. If you are looking up thousands of numbers per minute out of millions and millions and millions of possible choices, HashMap will still be blazingly fast, and you will drag a whole CPU down if you try to do that with an array.
hello sir i have a doubt
hashmap is not threadsafe so it is faster than hashtable
but you mention hashmap works with only one thread
by using only single thread how we can get faster performance.
please explain me
Sir said if you're working with only one thread then go for HashMap, otherwise go for Hashtable.
Say, there is a bucket X and its capacity has reached TREEIFY_THRESHOLD i.e., 8, but MIN_TREEFIY_CAPACITY is not yet reached, say MIN_TREEFIY_CAPACITY is still 16. Then the Linked List structure in bucket X will not be converted to Balanced Binary Tree as MIN_TREEFIY_CAPACITY is not yet reached. Instead number of buckets is doubled. So now, our MIN_TREEFIY_CAPACITY becomes 16+16=32. Say now we again try to add a value to hashmap which hash's to bucket X, then will the bucket X continue to store the values in a Linked List fashion as MIN_TREEFIY_CAPACITY is still not reached ?
Thanks
thank u so much
🙏 tq sir
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?
thank u da mota thala