src/share/classes/java/lang/Double.java

Print this page
rev 6190 : [mq]: reducers

*** 1019,1026 **** --- 1019,1068 ---- return (thisBits == anotherBits ? 0 : // Values are equal (thisBits < anotherBits ? -1 : // (-0.0, 0.0) or (!NaN, NaN) 1)); // (0.0, -0.0) or (NaN, !NaN) } + /** + * Adds two {@code double} values together as per the + operator. + * Suitable for conversion as a method reference to functional interfaces such + * as {@code BinaryOperator&lt;Double&gt;} or {@code DoubleBinaryOperator}. + * + * @param a an argument. + * @param b another argument. + * @return the sum of {@code a} and {@code b}. + * @since 1.8 + */ + public static double sum(double a, double b) { + return a + b; + } + + /** + * Returns the greater of two {@code double} values. + * Suitable for conversion as a method reference to functional interfaces such + * as {@code BinaryOperator&lt;Double&gt;} or {@code DoubleBinaryOperator}. + * + * @param a an argument. + * @param b another argument. + * @return the larger of {@code a} and {@code b}. + * @since 1.8 + */ + public static double max(double a, double b) { + return Math.max(a, b); + } + + /** + * Returns the lesser of two {@code double} values. + * Suitable for conversion as a method reference to functional interfaces such + * as {@code BinaryOperator&lt;Double&gt;} or {@code DoubleBinaryOperator}. + * + * @param a an argument. + * @param b another argument. + * @return the lesser of {@code a} and {@code b}. + * @since 1.8 + */ + public static double min(double a, double b) { + return Math.min(a, b); + } + /** use serialVersionUID from JDK 1.0.2 for interoperability */ private static final long serialVersionUID = -9172774392245257468L; }