Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
A DESCRIPTION OF THE REQUEST : Please provide us with varargs version of Math.min() and Math.max(), now that we have the celebrated varargs feature in Tiger. It would even be neatly implemented (but not strictly necessary) if it takes the following approach: public <T extends WellOrderedNumber> T min(T ... nums) { T ret = nums[0]; for(T num : nums) ret = min(ret, num); return ret; } which also utilises the auto-boxing / unboxing feature of the language as well. JUSTIFICATION : It is evidently useful to have varargs version of min() and max() compare to the existing binary comparison methods. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - long ans = Math.min(a, b, c, d, e, f); ACTUAL - long ans = Math.min(a, Math.min(b, Math.min(c, Math.min(d, Math.min(e, f))))); ###@###.### 2005-03-11 00:33:18 GMT
|