You have already looked at collections such as arrays and dictionaries, but there are many other types of collections, including sets, linked lists, heaps, stacks, and binary trees. In this chapter, I will cover the commonalities between different types of collections. Every collection organizes and stores multiple elements, and each collection type offers unique ways of accessing these elements. For example, with a dictionary, you can access elements by providing a key, while an array requires an index.
However, collections also have core functionality that all collections must support, such as being iterable. If something is iterable, you can access the individual elements in a for loop or use a higher-order function, such as map or filter.
What exactly makes something a collection? What are the differences and similarities between different collection types? And how can you make your own? You will explore these questions by expanding on the multistage rocket example from chapter 8. Because the rocket is made up of many different parts, it is possible to turn it into something Julia will recognize as a collection.