How Java HashMap Works

preview_player
Показать описание
Can you explain how Java HashMap works?

A Map in Java stores key and volume pairs. Keys have to be unique, and knowing the key lets you find the value.

I knew that much. A HashMap is basically an array with lots of numbers, and the key lets you identify which value in that array or map of values to use.

The HashMap class is how you implement the map interface.

Why not just use arrays or strings to store values?

Using a hash table with the map interface standardizes the time it takes to use operations like get and put.

HashMaps may be used to pull up account balances, last time someone logged in or other stored values. I never thought though that the speed at which it is retrieved mattered.

You create a HashMap with the command HashMap string integer cache equals new hashmap string integer () semicolon.

I thought there were other ways to create one.

Java will let you create a new HashMap copying data from another HashMap. Or create a Hashtable.

But how does the HashMap work?

It should then print out the value of that key location as an output.

That's right. The HashMap stores the values, and Java will retrieve the value referenced by the key like picking out the inventory on shelf 83, slot 5.

I've heard there were other benefits to using a HashMap.

Since the code knows exactly where to look for values, it retrieves values in the Hashmap faster than other methods. And it won't error out unless the value in the Hashmap is somehow an error in and of itself.

With Java, that's not hard to do.

HashMaps and HashTables also do not care about duplicate values, as long as the keys are different.

They could all be zero, as long as they all have separate addresses.

And the Java HashMap is the way it references those unique addresses.
Рекомендации по теме
Комментарии
Автор

may be you should avoid the audio to be system generated by some software. i would have been more convenient if the audio is of some human .

chavvz
Автор

I like this! The animation is great fun and even though the audio is strange at first, I actually grew to like it. Thanks!

grahamthomas
Автор

Amazing!  You all explain things very well!

WorklLife
Автор

"A Map in Java stores key and volume pairs" that would be Key and VALUE pairs. If you are here studying for an interview, this explains how to use a hash map, not how it works. You interviewer will likely press you for a deeper understanding about buckets, overriding .equals() and .hashcode(), and why that is significant. All maps support put and get, so research what is special about the hash implementation specifically.

JeffNeet
Автор

nothing in this video makes any sense, except for the java crap. Why are they having this meeting? What are these other people doing here? How does this relate to the pie chart? I don't understand

deleteaman
Автор

This vid would be fantastic if there weren't computer generated audio.

JustThink
Автор

hashmaps aren't arrays at all. why do you call them "arrays with lots of numbers." that's not a good description.

richgoldman
Автор

This would be infinitely better if you used human voices instead of some software. Because of the unclear audio, I stopped watching and learned nothing.

JulianHernandez-zwob
Автор

Would it be that much harder to overlay this with an actual American voice?

JoeExterminr
Автор

this is like learning over the telephone. sorry

mattshu
Автор

lmfao the guy is able to paint and animate people but isn't able to read for them wtf. Just use your own voice, come on dude

NormalHuman
join shbcf.ru