A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 垂天云 高级黑马   /  2013-9-8 14:59  /  1037 人查看  /  5 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

本帖最后由 垂天云 于 2013-9-8 16:32 编辑

JAVA 集合中,谁能够详细说一下Collection与Collections的区别?

谢谢了!

评分

参与人数 1黑马币 +3 收起 理由
特殊服务 + 3

查看全部评分

5 个回复

倒序浏览
Collection是集合类的上级接口,继承与他的接口主要有Set 和List.
Collections是针对集合类的一个帮助类,他提供一系列静态方法实现对各种集合的搜索、排序、线程安全化等操作。

评分

参与人数 1技术分 +1 收起 理由
张智文 + 1

查看全部评分

回复 使用道具 举报
看看文档,可以知道的。呵呵{:soso_e130:}
public class Collections extends Object
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.
这个类由专门的静态方法,处理或返回集合。它包含了多态算法操作集合,“包装”,它返回一个新的集合由指定的收集,和其他一些东西。
(Collections 操作集合类的工具类)

public interface Collection<E> extends Iterable<E>
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并不提供任何直接的实现这个接口:它提供了实现更多的具体设置和列表,个子像这个接口通常是用来传递集合和操纵它们周围,最大共性,是理想的。
(Collection是集合类的接口)

评分

参与人数 1技术分 +1 收起 理由
张智文 + 1

查看全部评分

回复 使用道具 举报
简单的说,
1、Collection 是一个集合接口。它提供了对集合对象进行基本操作的通用接口方法。Collection接口在Java 类库中有很多具体的实现。Collection接口的意义是为各种具体的集合提供了最大化的统一操作方式。
2、Collections 是一个包装类。它包含有各种有关集合操作的静态多态方法。此类不能实例化,就像一个工具类,服务于Java的Collection框架。
回复 使用道具 举报
Collections是个java.util下的类,它包含有各种有关集合操作的静态方法。
Collection是个java.util下的接口,它是各种集合结构的父接口。
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马