What You Learned

Data structures help you structure data. You’ll find that arrays and maps are everywhere. When you work with databases, your records will be returned to you as an array that you’ll have to loop through. When you want to read or modify configuration files, you’re going to work with arrays and maps. I’ve lost count of the number of times I’ve been asked to take an array of data and sort it somehow. And you will too.

Lists and maps are a great start, but you can define your own data structures, too, like a ShoppingCart.

So far we’ve gotten our data from the user, or we’ve coded it up ourselves. But in the next chapter, you’re going to get your data from files.

Get Exercises for Programmers 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.