如果在遍历的过程中有另外一个线程修改了list,那么采用for循环其执行结果是不确定的,而采用Iterator会快速失败(fast-fail)并抛出ConcurrentModificationException。所以在通常情况下,优先使用Iterator遍历集合对象。
基于20个网页-相关网页
Fail Fast 快速失败 ; 快一点失败 ; 快速放弃
fail fast-uitzondering 立即失败例外状况
fail-fast 机制
Fail Fast and Independently 快速且单独失效 ; 快速失败
Time is precious, so if you failed then you'd better fail fast.
时间是珍贵的,所以如果你失败了,最好让失败迅速成为过去。
So move quickly, test often, fail fast, and discuss and document your assumptions.
所以快点行动,经常测试,快速失败,讨论并用文件记录你的假设。
But there is no point in failing fast if you fail to learn from your mistakes.
如果你不能从错误中学习,即使失败得再快也变得毫无意义。
应用推荐