‫Now we're going to create our keys function.
‫I'll bring up an address space with a few items in it, and the keys function is going to return a vector
‫of strings, which is going to be the keys and the hash table.
‫So we'll create that vector like this, we'll call it all keys.
‫And in order to do this, we're going to need two different loops.
‫First, we need one that's going to iterate through the array.
‫And because we know exactly how many items are in the array, we'll do this with a four loop and then
‫we'll need a separate loop to loop through the length list, like the one we have at the index of six.
‫Now to loop through that length list, we'll need a variable that we call temp.
‫We'll create that like this and we'll set it equal to data map at the index of I the I from the for
‫loop.
‫And the loop that goes inside of this for loop is going to be a while loop.
‫And the reason for that is because we don't know how long the linked list is.
‫So we're just going to run this until we get to the end.
‫And then inside the wild loop will say all keys.
‫That is the vector push back that allows it to the end of the vector temp key.
‫So right now temp key is nails.
‫So we're adding nails to the vector.
‫And to move temp forward in the length list, we'll say temp equals temp next and then we'll add tile
‫and lumber.
‫And now the only thing left to do is to return all keys, which returns that vector.
‫So we'll look at this code in a moment in VTS code.
‫And when we do, we'll create a hash table that looks like this, except we will also add these two
‫items to make it a little bit more interesting.
‫And then we'll run the keys function and we'll expect it to return this vector.
‫So now let's flip over to VS code and take a look at this.
‫So there is our keys member function there and I'm going to scroll up.
‫So this line creates our hash table and these lines create our five key value pairs.
‫And then with this line we'll run a print table.
‫So I'll run this.
‫And that is our hash table there.
‫So now I'm going to come up and replace this line that says print table with these lines.
‫And with this line here, we're creating a vector of strings called my keys, and we're setting an equal
‫to my hash table keys.
‫And remember, that function returns a vector of strings, and then this for loop will print out all
‫of those keys in that vector.
‫And now I'll run this and you can see we get all of our keys paint, bolts, nails, tile and lumber.
‫And that is our function for keys.