数组列表顺序检索 [英] Array List retrieval order

查看:117
本文介绍了数组列表顺序检索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个java 的ArrayList 来我加5的对象。

I have a java ArrayList to which I add 5 objects.

如果我遍历列表,并把它们打印出来,然后遍历列表并重新打印出来。

If I iterate over the list and print them out, then iterate over the list and print them out again.

将在这两个案件中检索顺序是一样的? (我知道这可能是从插入顺序不同)

Will the retrieval order in these 2 cases be the same? (I know it may be different from the insertion order)

推荐答案

是的,假设你没有修改名单在两者之间。从<一个href=\"http://docs.oracle.com/javase/6/docs/api/java/util/List.html\">http://docs.oracle.com/javase/6/docs/api/java/util/List.html:

Yes, assuming you haven't modified the list in-between. From http://docs.oracle.com/javase/6/docs/api/java/util/List.html:

迭代器

的Iterator&LT; E&GT;迭代器()

返回列表中以正确的顺序在元素的迭代器。

Returns an iterator over the elements in this list in proper sequence.

一个有点模糊,也许,但在该页面的其它部分,这个词的定义是:

A bit vague, perhaps, but in other portions of that page, this term is defined:

适当顺序(从第一个到最后一个元素)

proper sequence (from first to last element)

这篇关于数组列表顺序检索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆