Difference between container and wrapper

十年热恋 提交于 2019-12-03 02:53:46

In programming languages the word container is generally used for structures that can contain more than one element, for example a Map, a Set or a List. These structures normally provide methods like contains, that are semantically suitable if the object can contain more than one item.

A wrapper instead is something that wraps around a single object to provide more functionalities and interfaces to it. The typical example is the Integer class that in Java wraps the base type int.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!