6.1. What Are Collections?
We'd like a way to gather up objects or value types as they are created so that they can be managed as a group and operated on collectively, along with referring to them individually when necessary. For example:
A Professor object may wish to step through all Student objects registered for a particular Course that the professor is teaching in order to compute their grades.
The SRS application as a whole may need to step through all the Course objects in the current schedule of classes to determine which of them don't yet have any students registered for them, possibly to cancel these courses.
We use a special type of object called a collection to group other objects or value types. A collection object can hold/contain ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access