I’m making an inventory system. The inventory is a map assigning a certain slot number to an item.
I can add items to a specified in the inventory. i.e put item x in slot 3.
Now I want to add an item to the first available slot. i.e slot 1-5 is taken, 7-9 is taken, 6 was never assigned and thus is empty. We should add item to that slot.
This has left me wondering, what value does a map hold when nothing is stored in its value? null? Is there a simpler way of doing this than to find every key and checking to see if it equals null or w.e?