Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在编程语言(例如Java)中,container和之间有什么区别wrapper(或有区别)。我听说这两个术语都含糊其辞。
container
wrapper
在编程语言中,容器一词通常用于可以包含多个元素的结构,例如Map、Set或List。这些结构通常提供类似 的方法contains,如果对象可以包含多个项目,则这些方法在语义上是合适的。
contains
相反,包装器是包装单个对象以提供更多功能和接口的东西。典型的例子是IntegerJava中封装了基类型的类int。
Integer
int