commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "david cogen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LANG-642) Need varargs form of NumberUtils.max(), etc
Date Fri, 13 Aug 2010 12:40:17 GMT

    [ https://issues.apache.org/jira/browse/LANG-642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12898207#action_12898207
] 

david cogen commented on LANG-642:
----------------------------------

On second thought, I attempted to prototype this scheme and was unable to prevent ambiguity
in choosing function signatures. It may not be possible with varargs as I described.

If not possible, it would be useful to extend the min() and max() functions to 4 arguments
rather than stop at 3. Example

int max (int i1, int i2, int i3, int i4)
and so on for the other number types.

There are good reasons for a limit of 4 args rather than 3. In my case, I wanted a simple
expression to give me the largest of the four margins of an Inset.

> Need varargs form of NumberUtils.max(), etc
> -------------------------------------------
>
>                 Key: LANG-642
>                 URL: https://issues.apache.org/jira/browse/LANG-642
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.math.*
>            Reporter: david cogen
>            Priority: Minor
>
> There should be a varargs form of the NumberUtils.max() and min() functions.
> E.g. int max (int... numbers)
> This might conflict with the existing int max (int[] numbers) but that function would
in fact not be needed if the varargs form existed because an array could be supplied to it
just as easily.
> Or, if it is undesirable to remove max(int[] numbers), then a varargs function could
be defined as
> int max (int number1, int... moreNumbers)
> which would work for any number of arguments greater than 0.
> Of course this function should be implemented for all number types (byte, short, float,
double, etc) and both max() and min() should be provided.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message