面试题:Java之ArrayList的特点?

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/cadi2011/article/details/86471821

Which statement is true for the class java.util.ArrayList?

下面那个选项有关java.util.ArrayList是正确的

A.The elements in the collection are ordered.

集合中的元素是有序的

B.The collection is guaranteed to be immutable.

集合不可改变

C.The elements in the collection are guaranteed to be unique.

集合中的元素必须唯一

D.The elements in the collection are accessed using a unique key.

集合中元素的键是唯一的

E.The elements in the collections are guaranteed to be synchronized.

扫描二维码关注公众号,回复: 4909558 查看本文章

集合中的元素是线程同步的

正确答案:

选A,元素在集合中有序,此时指的是元素插入过程中记录了元素的插入顺序,所以你遍历的时候,元素和你当时插入时的顺序是一致的

这边千万不要混淆了,不是说有序一定按照是元素的特征(对比的要求)进行排序,就算有序,比如整型,按照大小等排序

猜你喜欢

转载自blog.csdn.net/cadi2011/article/details/86471821