如果在遍历的过程中有另外一个线程修改了list,那么采用for循环其执行结果是不确定的,而采用Iterator会快速失败(fast-fail)并抛出ConcurrentModificationException。所以在通常情况下,优先使用Iterator遍历集合对象。
基于20个网页-相关网页
Fail Fast 快速失败 ; 快一点失败 ; 快速放弃
fail fast-uitzondering 立即失败例外状况
fail-fast 机制
Fail Fast and Independently 快速且单独失效 ; 快速失败
It forces fast-fail semantics on tests, even though some tests might want to continue past a verification failure.
这样对测试增加了失效实时处理(fast - fail)语义,即使有些测试可能希望在确认失效后继续执行。
But there is no point in failing fast if you fail to learn from your mistakes.
如果你不能从错误中学习,即使失败得再快也变得毫无意义。
So move quickly, test often, fail fast, and discuss and document your assumptions.
所以快点行动,经常测试,快速失败,讨论并用文件记录你的假设。
应用推荐