File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
core/src/main/java/fj/data Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1465,6 +1465,16 @@ public final A maximum(final Ord<A> o) {
14651465 return foldLeft1 (o ::max );
14661466 }
14671467
1468+ /**
1469+ * Returns the maximum element in this list according to the given ordering.
1470+ *
1471+ * @param o An ordering for the elements of the list.
1472+ * @return The optional maximum element in this list according to the given ordering.
1473+ */
1474+ public final Option <A > maximumOption (final Ord <A > o ) {
1475+ return headOption ().map (x -> maximum (o ));
1476+ }
1477+
14681478 /**
14691479 * Returns the minimum element in this list according to the given ordering.
14701480 *
@@ -1474,6 +1484,16 @@ public final A maximum(final Ord<A> o) {
14741484 public final A minimum (final Ord <A > o ) {
14751485 return foldLeft1 (o ::min );
14761486 }
1487+
1488+ /**
1489+ * Returns the minimum element in this list according to the given ordering.
1490+ *
1491+ * @param o An ordering for the elements of the list.
1492+ * @return The optional minimum element in this list according to the given ordering.
1493+ */
1494+ public final Option <A > minimumOption (final Ord <A > o ) {
1495+ return headOption ().map (x -> minimum (o ));
1496+ }
14771497
14781498 public final java .util .List <A > toJavaList () {
14791499 return new java .util .LinkedList <>(toCollection ());
You can’t perform that action at this time.
0 commit comments