 Hey everybody, this is Brian and if you're paying attention this is a visual basic tutorial 15 in our series today We're going to be discussing hash tables. So we'll say dim employees as hash table whoops Equal and remember we have to assign it now new Hash table this is strikingly similar to our list that we did in the last tutorial, but this is a little different What is a hash table? Why do we need it? Well, one of the limitations of a list is let's say you're adding two people named Bob Well, how do you tell the difference between the two? Well a hash table allows you to sign a unique key or ID number to these so you can say Employees dot Ed Notice how it says key as object value as object. What does that mean? Well key is a unique Identifier this could be an integer or string whatever you want because it's an object everything is an object and dot that and the values the value Whatever it'll be so we're gonna say the employee ID number 102. We'll call this Bob Smith Now let's try to add another Bob. We'll call this a Bob Hope Notice how they have the same key. That's a no-no when we try to run this Visual basics gonna explode and go hey hold the phone Item already been added the key and dictionary 102 being added as 102 basically what that means is these cannot have the same key They have to be unique So let's change this to say 105 Now we've got two different keys so we can add two people named Bob to our list. We haven't printed anything. I'm just showing you Now we have two different Bob's we can also Manipulate this list based on their key See here's a contains key If you're wondering what that does it returns whether or not the key exists Contains key 105. Let's see if Bob Hope exists and then console dot Right line Say Bob Hope exists So what we're saying is if the key of 105 exists Then Bob Hope exists. Well, why do we need any of this? We were perfectly happy with our arrays on our lists. Well if you start working with a lot of items And let's say you've got 4,000 names and out of those a thousand of them are Bob's Well, sure you could reiterate through them and figure out which ones which blah blah blah It's just easier if you have a simple unique key And that's what the hash table allows you to do Is you can find things and manipulate things based on their key No a good for example is let's just uh, let's just change this if employee contains We'll say We want to find which Bob this is employees item And notice how when we say parentheses it's saying key as object So let's just put in 105 because that's the key we're currently referencing Employees item with a key of 105 What that does is that grabs the value for us And it says Bob hope exists. Well, we forgot to put a space in there But you understand the basic concept here. Let's just throw a space in there That way we've done our due diligence and people will see this actually does work Bob Hope exists So that's what a hash table is and why you need it Um, I hope you found this video educational and entertaining and stay tuned