This refactor looks wrong to me. Want to make sure...
# intellij
s
This refactor looks wrong to me. Want to make sure I'm not being dumb. First version:
Copy code
for (element in this) if (!predicate(element)) return false
return true
says "if any element does not match the predicate, return false; otherwise, return true". Second version:
Copy code
return this.any { predicate(it) }
says "if any element matches the predicate, return true; otherwise, return false". These are not equivalent, right?