Collection are data structures that group items that have some shared attributes and need to be manipulated using common operations.
Generally speaking, all collection shares some property:
- Elements of a collection don't need to have a particular order.
- Elements of a collection can be of different types.
Since normal arrays hold a fixed amount of date items, they are not considered part of collections, although variable-size arrays are.
There are different types of collections:
- Linear collections: they define a particular order that will affect the way you can access to the elements.
- Linked lists
- Stacks
- Queues
- Priority queues
- Deques (Double ended queues)
- Double ended priority queues
- Associative collections: they are composed by collections of (key, value) pairs.
- Sets
- Multisets
- Associative arrays (map, dictionary, lookup table)
- Graphs: data items have associations with one or more other data items in the collections.
- Graphs
- Trees