Container (abstract data type)


In computer science, a container is a class, a data structure, or an abstract data type 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 it contains. Underlying implementations of various container types may vary in size and complexity, and provide flexibility in choosing the right implementation for any given scenario.

Function and properties

Containers can be characterized by the following three properties:
Container classes are expected to implement methods to do the following:
Containers are sometimes implemented in conjunction with iterators.

Types

Containers may be classified as either single-value containers or associative containers.
Single-value containers store each object independently. Objects may be accessed directly or with an iterator.
An associative container uses an associative 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:
s also use containers, which are special widgets to group other widgets, such as windows, panels. Apart from their graphical properties, they have the same type of behavior as container classes, as they keep a list of their child widgets, and allow adding, removing, or retrieving widgets among their children.