|
|
It has been suggested that this article or section be merged with Collection (abstract data type). (Discuss) Proposed since December 2011. |
|
|
This article may require cleanup to meet Wikipedia's quality standards. The specific problem is: text is clunky. Please help improve this article if you can. The talk page may contain suggestions. (March 2012) |
In computer science, a container is a class, a data structure, or an abstract data type (ADT) whose instances are collections of other objects. In other words; they are used for storing objects in an organized way following specific access rules. The size of the container depends on the number of the objects (elements) it contains.The underlying implementation of various types of containers may vary in space and time complexity allowing for flexibility in choosing the right implementation for a given scenario.
Contents |
Container can be studied under three points of views.
Container classes are expected to implement methods to do the following:
Containers are sometimes implemented in conjunction with iterators.
There are two types of containers:
store copies of objects.If we access an object, an object returns a copy of it. If external object is changed after it has been inserted in container will not affect the content of the container.
store pointers and references to the object. If we access an object, an object returns reference to it.If external object is changed after it has been inserted in container, affect the content of the container.
Containers are divided in the Standard Template Library into associative containers and standard sequence containers. Besides this two types, so-called container adaptors exist. Data structures that implement containers include arrays, lists, maps, queues, sets, stacks, tables, trees, and vectors.
Widget toolkits use special widgets also called Containers to group the other widgets together (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 to add, remove, or retrieve widgets amongst their children.
In object oriented programming, we define a container class as class capable of storing other objects.These classes usually implement some kind of data structure such as map, set, stacks etc.The size of the collection of objects is adjusted automatically in a container class.
| This section requires expansion. |
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||