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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-01 19:47:06  来源:igfitidea点击:

What is the difference between "collection" ,"Collection" and "Collections"?

javacollections

提问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)是一套实现普遍可重复使用的收集数据结构的类和接口。

Collectionis 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)的实现。此接口通常用于传递集合并在需要最大通用性的地方操作它们。

Collectionsis 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

阅读Oracle Java 集合教程

"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

  • collection: does not mean anything special. It can be a variable name you use to refer to a Collection

  • Collection: an interface that (most) collections implement - see javadoc

  • Collections: a set of utility methods - see javadoc
  • collection: 没有什么特别的意思。它可以是一个变量名,用于引用Collection

  • Collection:(大多数)集合实现的接口 - 请参阅javadoc

  • Collections:一组实用方法 - 请参阅javadoc

回答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 语言关键字。

collectionis most likely an identifier, a variable name perhaps ? As the first letter is small case.

collection最有可能是一个标识符,也许是一个变量名?由于第一个字母是小写。

Collectionis 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

Collectionsis a utility class with a set of static methods, which help with manipulation of Collectionobjects: 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

Collectionis an interface for various interfaces/classes for collections of elements, like List, ArrayList, Set and HashSet.

Collection是用于元素集合的各种接口/类的接口,如 List、ArrayList、Set 和 HashSet。

Collectionsis a utilityclass containing methods that can be used on classes that implement the Collectioninterface.

Collections是一个实用程序类,包含可用于实现Collection接口的类的方法。

collectionis just a variable name I think.

collection我认为只是一个变量名。

回答by Luca Basso Ricci

java.util.Collection: The root interface in the collection hierarchy
java.util.Collections: utility class
collection: I don't known

java.util.Collection:集合层次结构中的根接口
java.util.Collections:实用程序类
collection:我不知道

Read Oracle doc about collection

阅读有关集合的 Oracle 文档