This article mayrequirecleanup to meet Wikipedia'squality standards. The specific problem is:text is clunky. Please helpimprove this article if you can.(March 2012) (Learn how and when to remove this message) |

Incomputer science, acontainer is aclass or adata structure[1][2] whose instances are collections of other objects. In other words, they store objects in an organized way that follows specific access rules.
The size of the container depends on the number of objects (elements) it contains. Underlying (inherited) implementations of various container types may vary in size, complexity and type of language, but in many cases they provide flexibility in choosing the right implementation for any given scenario.
Container data structures are commonly used in many types ofprogramming languages.
Containers can be characterized by the following three properties:
Container classes are expected to implementCRUD-like methods to do the following:
Containers are sometimes implemented in conjunction withiterators.
Containers may be classified as eithersingle-value containers orassociative containers.
Single-value containers store each object independently. Objects may be accessed directly, by a language loop construct (e.g.for loop) or with aniterator.
An associative container uses anassociative array, map, or dictionary, composed of key-value pairs, such that each key appears at most once in the container. The key is used to find the value, the object, if it is stored in the container.Associative containers are used in programming languages as class templates.
Container abstract data types include:
Common data structures used to implement these abstract types include:
Widget toolkits also use containers, which are specialwidgets to group other widgets, such aswindows,panels. Apart from their graphical properties, they have the same type of behavior as container classes, as they keep a list of their childwidgets, and allow adding, removing, or retrievingwidgets among their children.
Container abstractions can be written in virtually any programming language, regardless of its type system.[3]: 273 However, instrongly-typedobject-oriented programming languages it may be somewhat complicated for a developer to write reusable homogeneous containers.
Because of differences in element types this results in a tedious process of writing and keeping a collection of containers for every elemental type.[3]: 274–276
Many elemental types (e.g. integers or floating numbers) are inherently incompatible with each other because of the memory size they occupy and their semantic meaning and therefore require different containers (unless of course, they are mutually compatible or convertible).[3]: 274–276 Modern programming languages offer various approaches to help solve the problem:[3]: 274–281