--- old/src/share/classes/java/lang/Integer.java 2012-11-29 17:05:25.092723883 -0800 +++ new/src/share/classes/java/lang/Integer.java 2012-11-29 17:05:24.920723875 -0800 @@ -1512,6 +1512,48 @@ ((i << 24)); } + /** + * Adds two integers together as per the + operator. + * Suitable for conversion as a method reference to functional interfaces such + * as {@code BinaryOperator<Integer>} or {@code IntBinaryOperator}. + * + * @param a an argument. + * @param b another argument. + * @return the sum of {@code a} and {@code b}. + * @since 1.8 + */ + public static int sum(int a, int b) { + return a + b; + } + + /** + * Returns the greater of two {@code int} values. + * Suitable for conversion as a method reference to functional interfaces such + * as {@code BinaryOperator<Integer>} or {@code IntBinaryOperator}. + * + * @param a an argument. + * @param b another argument. + * @return the larger of {@code a} and {@code b}. + * @since 1.8 + */ + public static int max(int a, int b) { + return (a >= b) ? a : b; + } + + /** + * Returns the lesser of two {@code int} values. + * Suitable for conversion as a method reference to functional interfaces such + * as {@code BinaryOperator<Integer>} or {@code IntBinaryOperator}. + * + * @param a an argument. + * @param b another argument. + * @return the lesser of {@code a} and {@code b}. + * @since 1.8 + */ + public static int min(int a, int b) { + return (a <= b) ? a : b; + } + /** use serialVersionUID from JDK 1.0.2 for interoperability */ private static final long serialVersionUID = 1360826667806852920L; }