java “收藏”、“收藏”和“收藏”有什么区别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17988479/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the difference between "collection" ,"Collection" and "Collections"?
提问by Mohsin Shaikh
difference between "collection" ,"Collection" and "Collections"
“收藏”、“收藏”和“收藏”的区别
In the java.util package we going to use these three keywords so what is the difference between these keywords. 1) collection 2) Collection 3) Collections.
在 java.util 包中我们将使用这三个关键字,那么这些关键字之间有什么区别。1) 收藏 2) 收藏 3) 收藏。
collection: It is word represent the Collection Object and Map object.
collection: 它是代表集合对象和地图对象的词。
Collection: It is the super Interface of all Collection i.e. in The Array Format.
Collection: 它是所有 Collection 的超级接口,即数组格式。
Collections: It is class , that contain the Utility methods to operate Collection Object.
集合:它是类,包含操作集合对象的实用程序方法。
回答by NINCOMPOOP
The Java collections framework (JCF)is a set of classes and interfaces that implement commonly reusable collection data structures.
在Java集合框架(JCF)是一套实现普遍可重复使用的收集数据结构的类和接口。
Collection
is an interface .
Collection
是一个接口。
The root interface in the collection hierarchy. A collection represents a group of objects, known as its elements. Some collections allow duplicate elements and others do not. Some are ordered and others unordered. The JDK does not provide any direct implementations of this interface: it provides implementations of more specific subinterfaces like Set and List. This interface is typically used to pass collections around and manipulate them where maximum generality is desired.
集合层次结构中的根接口。一个集合代表一组对象,称为它的元素。一些集合允许重复元素,而另一些则不允许。有些是有序的,有些是无序的。JDK 不提供此接口的任何直接实现:它提供了更具体的子接口(如 Set 和 List)的实现。此接口通常用于传递集合并在需要最大通用性的地方操作它们。
Collections
is a utility class , which has specific methods to work with collections.
Collections
是一个实用程序类,它具有处理集合的特定方法。
This class consists exclusively of static methods that operate on or return collections. It contains polymorphic algorithms that operate on collections, "wrappers", which return a new collection backed by a specified collection, and a few other odds and ends.
此类仅包含对集合进行操作或返回集合的静态方法。它包含对集合进行操作的多态算法、“包装器”,它返回由指定集合支持的新集合,以及其他一些零碎的东西。
Read Oracle Java Collections tutorial
"collection"is a term to denote a container for elements. It is not a keywordor any class/interface name in Java. It can be used as an identifier to refer to a Collection
. Probably you must have seen this :
“集合”是表示元素容器的术语。它不是Java 中的关键字或任何类/接口名称。它可以用作标识符来引用Collection
. 可能你一定见过这个:
Collection<String> collection ;
A collection — sometimes called a container — is simply an object that groups multiple elements into a single unit. Collections are used to store, retrieve, manipulate, and communicate aggregate data. Typically, they represent data items that form a natural group.
集合(有时称为容器)只是一个将多个元素组合成一个单元的对象。集合用于存储、检索、操作和交流聚合数据。通常,它们表示形成自然组的数据项。
回答by assylias
回答by Filip
Please read up on the Java API:
请阅读 Java API:
Collection: The root interface in the collection hierarchy. A collection represents a group of objects, known as its elements. Some collections allow duplicate elements and others do not. Some are ordered and others unordered. The JDK does not provide any direct implementations of this interface: it provides implementations of more specific subinterfaces like Set and List. This interface is typically used to pass collections around and manipulate them where maximum generality is desired.
Collections: This class consists exclusively of static methods that operate on or return collections. It contains polymorphic algorithms that operate on collections, "wrappers", which return a new collection backed by a specified collection, and a few other odds and ends.
集合:集合层次结构中的根接口。一个集合代表一组对象,称为它的元素。一些集合允许重复元素,而另一些则不允许。有些是有序的,有些是无序的。JDK 不提供此接口的任何直接实现:它提供了更具体的子接口(如 Set 和 List)的实现。此接口通常用于传递集合并在需要最大通用性的地方操作它们。
集合:这个类完全由对集合进行操作或返回集合的静态方法组成。它包含对集合进行操作的多态算法、“包装器”,它返回由指定集合支持的新集合,以及其他一些零碎的东西。
回答by S.D.
Neither of these are Java language keywords.
这些都不是 Java 语言关键字。
collection
is most likely an identifier, a variable name perhaps ? As the first letter is small case.
collection
最有可能是一个标识符,也许是一个变量名?由于第一个字母是小写。
Collection
is an interface, declaring the behavior of all the collection implementations:
http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Collection.html
Collection
是一个接口,声明所有集合实现的行为:http:
//docs.oracle.com/javase/1.5.0/docs/api/java/util/Collection.html
Collections
is a utility class with a set of static methods, which help with manipulation of Collection
objects:
http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Collections.html
Collections
是具有一组静态方法的实用程序类,有助于操作Collection
对象:http:
//docs.oracle.com/javase/1.5.0/docs/api/java/util/Collections.html
回答by Krishna Kumar Chourasiya
collection: It is simply a english word. You can use it to create any java object/instance variable
合集:它只是一个英文单词。您可以使用它来创建任何 java 对象/实例变量
Collection: Root interface of the collection framework. All the interface those are part of Collection Framework internally extends this interface.
Collection:集合框架的根接口。所有属于 Collection Framework 的接口都在内部扩展了这个接口。
Collections: It is a utility class in java which extends Object class.
Collections:它是java中的一个实用程序类,它扩展了Object类。
回答by Tobb
Collection
is an interface for various interfaces/classes for collections of elements, like List, ArrayList, Set and HashSet.
Collection
是用于元素集合的各种接口/类的接口,如 List、ArrayList、Set 和 HashSet。
Collections
is a utilityclass containing methods that can be used on classes that implement the Collection
interface.
Collections
是一个实用程序类,包含可用于实现Collection
接口的类的方法。
collection
is just a variable name I think.
collection
我认为只是一个变量名。
回答by Luca Basso Ricci
java.util.Collection
: The root interface in the collection hierarchyjava.util.Collections
: utility classcollection
: I don't known
java.util.Collection
:集合层次结构中的根接口java.util.Collections
:实用程序类collection
:我不知道
Read Oracle doc about collection
阅读有关集合的 Oracle 文档