Add IOBiFunction.noop()
MODIFY
src/main/java/org/apache/commons/io/function/IOBiFunction.java
src/main/java/org/apache/commons/io/function/IOBiFunction.java
@FunctionalInterface
public interface IOBiFunction<T, U, R> {
+ /**
+ * NOOP singleton.
+ */
+ @SuppressWarnings("rawtypes")
+ IOBiFunction NOOP = (t, u) -> null;
+
+ /**
+ * Returns The NOOP singleton.
+ *
+ * @param <T> the type of the first argument to the function
+ * @param <U> the type of the second argument to the function
+ * @param <R> the type of the result of the function
+ * @return The NOOP singleton.
+ */
+ static <T, U, R> IOBiFunction<T, U, R> noop() {
+ return NOOP;
+ }
+
/**
* Applies this function to the given arguments.
*

MODIFY
src/test/java/org/apache/commons/io/function/IOBiFunctionTest.java
src/test/java/org/apache/commons/io/function/IOBiFunctionTest.java
package org.apache.commons.io.function;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.IOException;
@@ -89,4 +90,10 @@ public void testApplyThrowsException() {
assertThrows(IOException.class, () -> isDirectory.apply(PathUtils.current(), PathUtils.EMPTY_LINK_OPTION_ARRAY));
}
+ @Test
+ public void testNoopIOConsumer() throws IOException {
+ assertNull(IOBiFunction.noop().apply(null, null));
+ assertNull(IOBiFunction.NOOP.apply(null, null));
+ }
+
}

Add IOBiFunction.noop()