More Java Collections – Meet Java Hashmap
Java HashMaps
are neat. They are part of the Java Collections and a kind of cousin to ArrayList
which we have now used in two projects (this will be the third). They basically encapsulate really useful data storage techniques that would otherwise be quite technical for us to code successfully for ourselves.
We will get practical with HashMap
in the next section when we discuss a problem regarding storing Bitmap
instances in our GameObject
instances. HashMap
will be the second part (Singletons are the first part) of the solution to this problem.
I thought it would be worth taking a first look at HashMap
on its own.
Suppose, we want to store the data of lots of characters from an RPG type game and each different ...
Get Learning Java by Building Android Games - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.