@ Colin
Thanks for the ProGuard tip. Indeed, first.isEmpty() ? second : first
is an easy alternative, the irritation comes after the second time you
reapeat it in more than two projects.
@ Louis
Thanks for the concrete answer ("...utility times ubiquity..."). It's
much more solid than any feelings expressed on a given topic. Once
again, I agree that "collection.isEmpty() ? fallback : collection;"
is not a bad workaround as long as it does not appear several times in
different project, then it becomes like an itch.
I consider the discussion for closed if you really have tried what
I've proposed against “the Google's entire Java code base to examine
for use cases” and you have found no common use. Please, accept my
apologies for taking your time.
Ivan
On Mar 1, 6:41 pm, Louis Wasserman <
wasserman.lo...@gmail.com> wrote:
> The most relevant metric to the Guava team is, more or less, utility times
> ubiquity.
>
> So at one extreme, Guava ends up containing features with great utility to
> a narrow set of users, e.g. MinMaxPriorityQueue -- an extremely nontrivial
> data structure, but when you need it, you *really* need it -- and on the
> other end, you get tiny features that are used basically everywhere, like
> Lists.newArrayList, a one-liner whose primary reason for existence is
> saving Java 6 users a few generic arguments. (And then you get things like
> Multiset, which have great utility *and* great ubiquity!)
>
> In terms of "marketing research reports," Guava has Google's entire Java
> codebase to examine for use cases, and when we're particularly unsure as to
> the utility of a method, we *do* those studies, ourselves, personally;
> we're not handed them by some marketing team. Certainly it's a somewhat
> subjective call: what if a method has five users? Ten? Twenty? If those
> numbers don't answer the question, then we discuss it some more.
> Frequently, we decide to hold off on adding the method unless more users
> surface.
>
> But we always make the comparison with the workarounds that are already
> available. In this case, the workaround is "collection.isEmpty() ?
> fallback : collection;" which is not, all things considered, a bad
> workaround at all.
>
> Those rare times I can remember personally having to special-case an empty
> collection, it typically deserved an if/else of its own, and sometimes a
> comment. But those occasions were relatively rare, compared to the other
> one-line utility methods Guava provides.
>
> Louis Wasserman
> wasserman.lo...@gmail.comhttp://
profiles.google.com/wasserman.louis
> > > > To get help:
http://stackoverflow.com/questions/ask(usethe tag