Collections APIs provide developers with a set of classes and interfaces that make it easier to handle collections of objects. In a sense, collections work a bit like arrays, except their size can change dynamically, and they have more advanced behaviour than arrays.
There is a standard C library, GLib, that provides lists, hash tables, growable arrays, trees, simple and multi-key maps and some uncommon collections like quarks, keyed lists and memory chunks.
C++ Container framework provides vectors (sizeable arrays), queues, lists, stacks, sets and maps. Maps in this framework may have multiple keys.
Java collections framework provides sets, lists, hash tables, ordered (linked) hash tables, stacks and queues. There are also specialized collections to work with multiple threads (blocking queues, etc).
There are three main types of collections:
- Lists: always ordered, may contain duplicates and can be handled the same way as usual arrays
- Sets: cannot contain duplicates and provide random access to their elements
- Maps: connect unique keys with values, provide random access to its keys and may host duplicate values
The .NET Framework provides specialized classes for data storage and retrieval. These classes provide support for stacks, queues, lists, and hash tables. Most collection classes implement the same interfaces, and these interfaces may be inherited to create new collection classes that fit more specialized data storage needs.
Some Popular Questions in Stackoverflow: