collection
An object that holds a group of items, such as a list, dictionary, set or array.
In more detail
Languages provide several kinds, each suited to a different question: by position, by key, by membership, or a fixed size. A list keeps items in order, a set holds unique items with fast membership tests, and a dictionary looks values up by key. Picking the right one keeps lookups fast and code clear.
Example
.NET: List<T>, Dictionary<TKey, TValue>, HashSet<T>, T[]Related terms
- List<T> — The .NET growable array: items keep their order, reading by index is constant time, and searching by value walks the whole list.
- Dictionary<TKey, TValue> — The .NET collection that maps unique keys to values and finds a value by its key in constant time by hashing the key.
- HashSet<T> — The .NET collection of unique items that answers 'have I seen this one already?' in constant time.
- array — A sequence of same-sized slots stored one after another in a single block of memory, so any slot can be reached by its index directly.
- list — An ordered, changeable collection of values written in square brackets, such as [3, 1, 4].
- tuple — An ordered, fixed-length group of values in which each position can have its own meaning and type.
- set (Python) — An unordered collection of distinct values, written {1, 2, 3} or made with set(), where each value appears only once.
- dictionary — A Python collection that stores values under keys, written in curly brackets, such as {"tea": 250}.
Taught in
- Collections, Generics, and LINQ — Modern .NET Core, C# & Enterprise Microservices
- What A Program Really Is — Hands-on Python: Complete Video Course & Book
- What Python Is, And Where It Came From — Hands-on Python: Complete Video Course & Book
- Types And Functions, A Whirlwind Tour — Hands-on Python: Complete Video Course & Book
- Appending To Lists, Sets, Constructors — Hands-on Python: Complete Video Course & Book
- Mad Libs Revisited: The Whole Program — Hands-on Python: Complete Video Course & Book
- A Standard Library Tour — Hands-on Python: Complete Video Course & Book
- Thirty Questions, One Sneaky Print — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Forty Minutes, Thirty Items: How PCEP Is Run — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Conditions The Exam Loves — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Control Flow Sprint — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Tuples, And The Comma That Makes Them — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Dictionaries: Keys, Values And Items — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Strings: Escapes, Slices And Methods — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Collections Sprint — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Twelve Traps, One Shape Each — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Mock, Review And Exam Day — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep