- 28 Downloads
A collection is a container that holds data while it is being manipulated by a computer program. More specifically, it is a data structure that consists of zero or more items, where each item contains its own value or values. Examples of collections include stacks, queues, linked lists, and sorted lists. The total number of items in a collection is its count. Unlike an array, a collection is dynamically allocated in memory. That is, its capacity is automatically increased (through memory reallocation) as additional items are added to it. Like an array, a collection is considered an internal data structure because it resides in RAM and only remains there until the program that utilizes it terminates. Thus, the data in a collection is said to be nonpersistent. This is in contrast to a database table, which is considered an external data structure because it resides on a peripheral device (e.g., a magnetic disk) and remains there even after the program that utilizes it terminates. Thus, the data in a database table is said to be persistent.