Closed non closed 11 years ago
I agree with this check, but I'd like to add configuration to Linter first... until then I'm trying to keep the number of the potentionally nagging warnings down :)
So, right now I'll add it for the types where it really is a lot slower, and later I'll allow users to crank the warning up to all types, if they wish to.
Often I'll see code that does
_.size == 0
or_.length == 0
when_.isEmpty
would be better. It's good to get people into this habit since for some collections (notablyList[_]
) getting the size is an O(n) operation whereas checking emptiness is O(1).