One level above atomic literals in complexity are collection literals, which aggregate multiple objects. In the ODMG Object Model, they come in several forms, each with specific use-case adaptations.
Collection literals include:
- Set: An unordered group of unique elements. Ideal for scenarios where duplicates are unnecessary.
- List: An ordered sequence, allowing duplicates. Lists are useful for maintaining an explicit order of items.
- Bag: An unordered collection permitting duplicates, perfect for aggregation without concern for order.
- Array: A fixed-size ordered sequence, allowing fast access through indexing.
Operations on collection literals generally focus on managing the included elements:
- Adding and removing elements.
- Checking for membership.
- Iterating over items within collections.
These functionalities make collection literals versatile for various programming needs.