Probably because both compile down into max(Object[]). But when I read Joshua Bloch's Effective Java, he recommends doing something like this:
max(double, double) max(double, double, double) max(double, double, double, double...) That would be nice. The behind-the-sceneds Object[] creation only happens if you inline 4. Is it worth the effort? Paul On Wed, Nov 18, 2009 at 12:37 AM, Henri Yandell <[email protected]> wrote: > On Mon, Nov 16, 2009 at 11:48 PM, Henri Yandell <[email protected]> wrote: >> On Mon, Nov 16, 2009 at 10:16 AM, Paul Benedict <[email protected]> wrote: >>> * Is there any benefit to making NumberUtils.min/max accept a variable >>> arguments over a single array? >> >> Seems good. > > From LANG-396: > > NumberUtils.min, NumberUtils.max varargs runs into the no overloading > recommendation: > > src/test/org/apache/commons/lang/math/NumberUtilsTest.java:[1175,42] > reference to max is ambiguous, both method max(double...) in > org.apache.commons.lang.math.NumberUtils and method max(float...) in > org.apache.commons.lang.math.NumberUtils match > > So - tried that, had problems. > > Hen > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
