Next Up

In this chapter you’ve learned the difference between local and global variables. You can use a simple Array or the more flexible ArrayList to store a pile of data, and traverse it using a for-each iterator.

Arrays are great if you don’t really care about finding one of the objects in the array by itself. However, if you care about objects by name—like a Player—then you’ll need something a little fancier.

In the next chapter we’ll cover how to use a HashMap to store data by name (or by Location, or by anything else you might need).

Get Learn to Program with Minecraft Plugins, 2nd 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.