Difference between collection and container

advertisements

I am little confused about the difference between containers and collections. I read about them on Wikipedia and this is what I have understood..

Collections : Stores variable number of objects. Ex. list, set...

Containers : DataStructures? Ex. dequeue, stack..

But I thought collections like list, tree etc are data structures, then what are containers. Also what does this mean..

Data structures that implement containers include arrays, lists, maps, queues, sets, stacks, tables, trees, and vectors.


Java doesn't really use the term "container," except in the context of AWT GUI components, in which a Container represents a GUI component that can contain other components.

Collection is used in Java for data structures that contain objects, as you describe.

Computer science in general tends to treat them as more or less synonymous.