它是安全的假设两个itterations在相同的集合将返回对象以相同的顺序?显然,假设集合工作尚未改变。
Is it safe to assume that two itterations over the same collection will return the objects in the same order? Obviously, it is assumed that the collection has not otherwise been changed.
简短的回答 - 是的,
Short answer - yes.
显然,虽然,这两个项目集合中的顺序可能不完全,因为它们被插入,这取决于集合的类型(一个字典,例如)。
Obviously, though, the order of the items in the collection may not be exactly as they were inserted, depending on the type of collection (a dictionary, for example).
但你会使用foreach循环每次迭代一个单一的,未经修改的收集时间得到相同的结果。
But you will get the same results each time you iterate over a single, unmodified collection using a foreach loop.
上一篇:为什么Android的服务崩溃,并抛出NullPointerException异常?抛出、异常、Android、NullPointerException
下一篇:System.ArgumentException:该表类型参数必须有一个有效的类型名称类型、有一、名称、有效