Why is there always isEmpty whereas I use !isEmpty 99% of the time

java

Solution

`isEmpty` follows the naming convention of other syntactically positive `isXXX` methods such as isVisible and isEnabled

Problem

This question has bogged me quite a while. During programming there is regularly the question whether there is something in an object or not. For this reason was the `isEmpty` method invented. Great, but in practice we use it like `!isEmpty` almost all the time. As a consequence, `notEmpty` would be a much more appreciated addition to a language like Java. The question is: why don't language designers think of this before defining the API? At least give a counterpart for `isEmpty` EDIT: I meant there should be a `notEmpty` as well as `isEmpty`. Depending on the domain, both of them may be used but in most cases when a UI is not involved, I think `notEmpty` applies better. EDIT2: To close the discussion, here is an example: ``` !metadata.isEmpty() == metadata.notEmpty() ``` I'd prefer we had the right side of the equation as well.

Original source