报告可以收起为单个 Collection.removeIf() 调用的循环。

示例:


  for (Iterator<String> it = collection.iterator(); it.hasNext(); ) {
    String aValue = it.next();
    if(shouldBeRemoved(aValue)) {
      it.remove();
    }
  }

在应用快速修复后:


  collection.removeIf(aValue -> shouldBeRemoved(aValue));