JDK-4254492 : Math.min() and Math.max() extension
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.2.2
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_95
  • CPU: x86
  • Submitted: 1999-07-15
  • Updated: 2014-08-05
  • Resolved: 2014-08-05
Related Reports
Relates :  
Relates :  
Description
Name: rlT66838			Date: 07/15/99


Adding the following two methods to the Math class would
increase the consistency and convenient of writing code in
the Java language.Implementing the Comparable interface is the
minimum requirement to determine the results of both methods
listed below.

public Comparable min(Comparable a, Comparable b){}

and

public Comparable max(Comparable a, Comparable b){}
(Review ID: 85641) 
======================================================================

Comments
The requested functionality is not provided as part of the streams API in java.util.stream.Collectors.{minBy, maxBy}. Closing as will not fix.
05-08-2014

EVALUATION With generics, now more sensible type constraints could be imposed, something like <T> Comparable<T> min(Comparable<T> a, Comparable<T> b)
09-11-2005

EVALUATION Not an unreasonable suggestion; although very easy to provide your own methods with that functionality. ###@###.### 2002-03-12
12-03-2002