14. Store Objects in Data Structures

In This Chapter

Create an array list

Add and remove items from the list

Search a list for an object

Loop through the contents of a list

Create a hash map of keys and values

Add and remove items from the map

Loop through the keys and values of a map

Programmers are hoarders.

In computer programming, you spend a lot of time collecting information and looking for a place to store it. The information can come in the form of a primitive data type, such as a float, or as an object of a particular class. It can be read from disk, retrieved from an Internet server, entered by a user, or gathered through other means.

After you have the information, you must decide where to put it while a program is ...

Get Absolute Beginner’s Guide to Minecraft® Mods Programming, 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.