src/share/classes/java/lang/Long.java
Print this page
rev 6151 : imported patch reducers
@@ -1537,8 +1537,50 @@
i = (i & 0x00ff00ff00ff00ffL) << 8 | (i >>> 8) & 0x00ff00ff00ff00ffL;
return (i << 48) | ((i & 0xffff0000L) << 16) |
((i >>> 16) & 0xffff0000L) | (i >>> 48);
}
+ /**
+ * Adds two {@code long} values together as per the + operator.
+ * Suitable for conversion as a method reference to functional interfaces such
+ * as {@code BinaryOperator<Long>} or {@code LongBinaryOperator}.
+ *
+ * @param a an argument.
+ * @param b another argument.
+ * @return the sum of {@code a} and {@code b}.
+ * @since 1.8
+ */
+ public static long sum(long a, long b) {
+ return a + b;
+ }
+
+ /**
+ * Returns the greater of two {@code long} values.
+ * Suitable for conversion as a method reference to functional interfaces such
+ * as {@code BinaryOperator<Long>} or {@code LongBinaryOperator}.
+ *
+ * @param a an argument.
+ * @param b another argument.
+ * @return the larger of {@code a} and {@code b}.
+ * @since 1.8
+ */
+ public static long max(long a, long b) {
+ return (a >= b) ? a : b;
+ }
+
+ /**
+ * Returns the lesser of two {@code long} values.
+ * Suitable for conversion as a method reference to functional interfaces such
+ * as {@code BinaryOperator<Long>} or {@code LongBinaryOperator}.
+ *
+ * @param a an argument.
+ * @param b another argument.
+ * @return the lesser of {@code a} and {@code b}.
+ * @since 1.8
+ */
+ public static long min(long a, long b) {
+ return (a <= b) ? a : b;
+ }
+
/** use serialVersionUID from JDK 1.0.2 for interoperability */
private static final long serialVersionUID = 4290774380558885855L;
}