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.
列表(扩展收藏)
An ordered collection (also known as a
sequence). The user of this interface
has precise control over where in the
list each element is inserted. The
user can access elements by their
integer index (position in the list),
and search for elements in the list.
Unlike sets, lists typically allow
duplicate elements. More formally,
lists typically allow pairs of
elements e1 and e2 such that
e1.equals(e2), and they typically
allow multiple null elements if they
allow null elements at all. It is not
inconceivable that someone might wish
to implement a list that prohibits
duplicates, by throwing runtime
exceptions when the user attempts to
insert them, but we expect this usage
to be rare.
# 1 楼答案
Java API是最好的答案
收藏
列表(扩展收藏)
# 2 楼答案
列表和集合是集合的两个子类
在列表中,数据按特定顺序排列
在集合中,它不能包含两次相同的数据
在集合中,它只存储没有特定顺序的数据,并且可以包含重复的数据
# 3 楼答案
^{} 是java集合层次结构的根接口^{} 是定义有序集合的一个子接口,其他子接口是^{} ,通常将存储准备好处理的元素(例如stack)
下图演示了不同java集合类型之间的关系:
# 4 楼答案
Collection是List的超级接口,因此每个Java List都是collection的一个实例。集合只能按顺序(并且没有特定的顺序)访问,而列表允许通过
get(int index)
方法访问特定位置的元素# 5 楼答案
Collection是Java Collections层次结构的主接口,List(Sequence)是定义有序集合的子接口之一
# 6 楼答案
首先:a^{} 是a^{} 。然而,它是一种特殊的
Collection
一个
Collection
就是:一个项目的集合。你可以添加,删除,迭代,查询里面有多少东西A
List
向其添加有关已定义的内容序列的信息:可以在n位置获取元素,可以在n位置添加元素,可以在n位置移除元素在
Collection
中,您不能这样做:“这个集合中的第五个元素”没有定义,因为没有定义顺序还有其他专门的集合,例如^{} ,它添加了一个特性,即它永远不会包含同一个元素两次