This question has eclipsed me quite a long time. During programming, the question regularly arises whether there is something in the object or not. For this reason, the isEmpty method was invented. Great, but in practice we use it like !isEmpty almost all the time.
As a result, notEmpty will be a much more valuable addition to a language like Java. The question is, why do language developers not think about this before defining an API? At least give an analog to isEmpty
EDIT: I meant that it should be notEmpty as well as isEmpty . Depending on the domain, both of them can be used, but in most cases when the user interface is not involved, I think that notEmpty is better applied.
EDIT2: To close the discussion, here is an example:
!metadata.isEmpty() == metadata.notEmpty()
I would prefer that we have the right side of the equation.
java
allprog
source share