Learning HashMaps in Java Tutorial
Автор: Zenva
Загружено: 2020-06-23
Просмотров: 4064
ACCESS the FULL COURSE here: https://academy.zenva.com/product/jav...
TRANSCRIPT
With arrays and ArrayLists, we stored values at specific indexes so the position of the elements is how we identified their values. With HashMaps, we store values at keys rather than at indexes so the position of the elements doesn’t matter. This is beneficial if we want to create a mapping of keys to values. Let’s set up the inventory but with item names and quantities. We can set the keys to be the names and the values to be the quantities. We must first import the HashMap library. Note how we set the key and value in the angle brackets and that the value is not int. It wants an object of the Integer class but for our purposes it’s exactly the same as a regular int. We have String type keys and int type values. We can then put the values into the HashMap by passing in the key and value.
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: