This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new ec803b1662 Tweak javadoc further
ec803b1662 is described below
commit ec803b1662c3ca2cb27be84e90fc0696d74afcfb
Author: Daniel Sun <[email protected]>
AuthorDate: Fri Jan 3 23:31:37 2025 +0900
Tweak javadoc further
---
.../groovy/util/function/FloatUnaryOperator.java | 53 ++++++++++++++++++----
1 file changed, 44 insertions(+), 9 deletions(-)
diff --git a/src/main/java/groovy/util/function/FloatUnaryOperator.java
b/src/main/java/groovy/util/function/FloatUnaryOperator.java
index 2c5974e647..08bbecdf87 100644
--- a/src/main/java/groovy/util/function/FloatUnaryOperator.java
+++ b/src/main/java/groovy/util/function/FloatUnaryOperator.java
@@ -19,34 +19,69 @@
package groovy.util.function;
import java.util.Objects;
-import java.util.function.UnaryOperator;
/**
* Represents an operation on a single {@code float}-valued operand that
produces
* a {@code float}-valued result. This is the primitive type specialization of
- * {@link UnaryOperator} for {@code float}.
+ * {@link java.util.function.UnaryOperator} for {@code float}.
*
* <p>This is a <a href="package-summary.html">functional interface</a>
* whose functional method is {@link #applyAsFloat(float)}.
*
- * @see UnaryOperator
+ * @see java.util.function.UnaryOperator
* @since 5.0.0
*/
@FunctionalInterface
public interface FloatUnaryOperator {
-
+ /**
+ * Applies this operator to the given operand.
+ *
+ * @param operand the operand
+ * @return the operator result
+ */
float applyAsFloat(float operand);
- default FloatUnaryOperator andThen(FloatUnaryOperator after) {
- Objects.requireNonNull(after);
- return (float f) -> after.applyAsFloat(applyAsFloat(f));
- }
-
+ /**
+ * Returns a composed operator that first applies the {@code before}
+ * operator to its input, and then applies this operator to the result.
+ * If evaluation of either operator throws an exception, it is relayed to
+ * the caller of the composed operator.
+ *
+ * @param before the operator to apply before this operator is applied
+ * @return a composed operator that first applies the {@code before}
+ * operator and then applies this operator
+ * @throws NullPointerException if before is null
+ *
+ * @see #andThen(FloatUnaryOperator)
+ */
default FloatUnaryOperator compose(FloatUnaryOperator before) {
Objects.requireNonNull(before);
return (float f) -> applyAsFloat(before.applyAsFloat(f));
}
+ /**
+ * Returns a composed operator that first applies this operator to
+ * its input, and then applies the {@code after} operator to the result.
+ * If evaluation of either operator throws an exception, it is relayed to
+ * the caller of the composed operator.
+ *
+ * @param after the operator to apply after this operator is applied
+ * @return a composed operator that first applies this operator and then
+ * applies the {@code after} operator
+ * @throws NullPointerException if after is null
+ *
+ * @see #compose(FloatUnaryOperator)
+ */
+ default FloatUnaryOperator andThen(FloatUnaryOperator after) {
+ Objects.requireNonNull(after);
+ return (float f) -> after.applyAsFloat(applyAsFloat(f));
+ }
+
+ /**
+ * Returns a unary operator that always returns its input argument.
+ *
+ * @return a unary operator that always returns its input argument
+ */
static FloatUnaryOperator identity() {
return f -> f;
}