RFC: draft API for JEP 269 Convenience Collection Factories
stuart.marks at oracle.com
Wed Oct 14 04:18:21 UTC 2015
On 10/10/15 9:10 AM, Louis Wasserman wrote:
> If you're asking about why we stopped where we did, we collected actually
> rather a lot of data on the size of static collection constants using
> immutable collections, both with builder syntax and without.
> https://github.com/google/guava/issues/2071#issuecomment-126468933 has the
> statistics (in terms of ratios, not absolute numbers), but we found that
> there was right about an exponential trend: static collection constants of
> size n+1 were ~half as common as collection constants of size n.
Yes, this is mainly the issue that I'm interested in. Thanks for the pointer to
these statistics. It's interesting that there seems to be a steady dropoff. But
that makes it hard to decide where to cut it off, as there's no obvious "knee"
of the curve.
With a few elements, indeed it seems that the distribute drops off proportional
to the power of 0.5, but it flattens out around considerably above 7. I'm not
sure what this means. (I have a hunch this is related to Benford's Law  but
this is only a hunch.)
I'm not entirely sure what to take from this. If it were clearly exponential, we
could say with confidence that above a certain threshold there would be
vanishingly little benefit adding more arguments. But since the curve seems to
flatten out, maybe this is pushing us to add more pairs than we had originally
thought. The current draft API has 8 pairs; that seems to leave a few percent of
cases on the table. Obviously we can't get to 100%, but is 97% good enough?
More information about the core-libs-dev