Personally, I like it. :)> How about supplementing / replacing with foo.hasElements()?
I'd prefer supplementing, since I also have a lot of places where I
use isEmpty unnegated.
Am 11.05.2012 15:49 schrieb "James Ots" <m...@jamesots.com>:
>
> isNotEmpty?
Please read the thread again.
This would be counterproductive to the
OP's request and intention.
>>> hasContent
>>> hasItems
>>> hasData
The opposite of isEmpty is isFilled IMHO. As this is unusual in regard to current languages' APIs, I prefer hasData.
My 2c
hasValue
hasItems
notEmpty
Am 12.05.2012 12:33 schrieb "William Hesse" <whe...@google.com>:
>
> To me, the English synonym for not-empty is nonempty. The advantage
> is that isNonempty() has only one capitalization (for typing speed),
> the capital letter is different (N rather than I).
>
> But perhaps nonempty is not known well to non-native speakers.
Beside that, I'm in doubt that any word that does not explicitly declare the state without applying a negation (like is the case with 'if' and 'unless') would really gain anything here.
I consider expressions like foo.bar.baz.whatelse.isEmpty a design flaw anyway, as it contradicts the Law of Demeter, so the argument of ! being too far away doesn't hold IMO.
--
Det
Jay: I assume that's the idea; any([bool condition(x) = (x) => true])
That's certainly how any? works is ruby (though I didn't know about the default value, I just use .empty?).
I might reasonably submit Microsoft's solution for comparison:
Basically:if (list.Any(x => f(x))) { ... }but with the predicate defaulting to `x => true`.