diff --git a/src/main/java/org/apache/commons/lang3/JavaVersion.java b/src/main/java/org/apache/commons/lang3/JavaVersion.java
index 355b6ab6e..feb53bd16 100644
--- a/src/main/java/org/apache/commons/lang3/JavaVersion.java
+++ b/src/main/java/org/apache/commons/lang3/JavaVersion.java
@@ -183,6 +183,11 @@ public enum JavaVersion {
*/
JAVA_RECENT(maxVersion(), Float.toString(maxVersion()));
+ /**
+ * The regex to split version strings.
+ */
+ private static final String VERSION_SPLIT_REGEX = "\\.";
+
/**
* Transforms the given string with a Java version number to the
* corresponding constant of this enumeration class. This method is used
@@ -313,11 +318,6 @@ private static float toFloatVersion(final String value) {
*/
private final String name;
- /**
- * The regex to split version strings.
- */
- private static final String VERSION_SPLIT_REGEX = "\\.";
-
/**
* Constructs a new instance.
*
diff --git a/src/main/java/org/apache/commons/lang3/SystemProperties.java b/src/main/java/org/apache/commons/lang3/SystemProperties.java
index 54137332d..1c2d03653 100644
--- a/src/main/java/org/apache/commons/lang3/SystemProperties.java
+++ b/src/main/java/org/apache/commons/lang3/SystemProperties.java
@@ -3708,6 +3708,20 @@ public static String getProperty(final String property) {
return getProperty(property, Suppliers.nul());
}
+ /**
+ * Gets a System property, defaulting to {@code null} if the property cannot be read.
+ *
+ * If a {@link SecurityException} is caught, the return value is {@code null}.
+ *
+ *
+ * @param property the system property name.
+ * @param defaultIfAbsent use this value when the property is empty or throws SecurityException.
+ * @return the system property value or {@code null} if a security problem occurs
+ */
+ static String getProperty(final String property, final String defaultIfAbsent) {
+ return getProperty(property, () -> defaultIfAbsent);
+ }
+
/**
* Gets a System property, defaulting to {@code null} if the property cannot be read.
*
@@ -3734,20 +3748,6 @@ static String getProperty(final String property, final Supplier defaultI
}
}
- /**
- * Gets a System property, defaulting to {@code null} if the property cannot be read.
- *
- * If a {@link SecurityException} is caught, the return value is {@code null}.
- *
- *
- * @param property the system property name.
- * @param defaultIfAbsent use this value when the property is empty or throws SecurityException.
- * @return the system property value or {@code null} if a security problem occurs
- */
- static String getProperty(final String property, final String defaultIfAbsent) {
- return getProperty(property, () -> defaultIfAbsent);
- }
-
/**
* Gets the current value from the system properties map.
*
diff --git a/src/main/java/org/apache/commons/lang3/function/Consumers.java b/src/main/java/org/apache/commons/lang3/function/Consumers.java
index 43f161d07..49b514ec1 100644
--- a/src/main/java/org/apache/commons/lang3/function/Consumers.java
+++ b/src/main/java/org/apache/commons/lang3/function/Consumers.java
@@ -31,21 +31,6 @@ public class Consumers {
@SuppressWarnings("rawtypes")
private static final Consumer NOP = Function.identity()::apply;
- /**
- * Gets the NOP Consumer singleton.
- *
- * @param type type to consume.
- * @return the NOP Consumer singleton.
- */
- @SuppressWarnings("unchecked")
- public static Consumer nop() {
- return NOP;
- }
-
- private Consumers() {
- // No instances.
- }
-
/**
* Applies the given {@link Consumer} action to the object if the consumer is not {@code null}. Otherwise, does
* nothing.
@@ -60,4 +45,19 @@ public static void accept(final T object, final Consumer consumer) {
consumer.accept(object);
}
}
+
+ /**
+ * Gets the NOP Consumer singleton.
+ *
+ * @param type type to consume.
+ * @return the NOP Consumer singleton.
+ */
+ @SuppressWarnings("unchecked")
+ public static Consumer nop() {
+ return NOP;
+ }
+
+ private Consumers() {
+ // No instances.
+ }
}
diff --git a/src/main/java/org/apache/commons/lang3/function/Functions.java b/src/main/java/org/apache/commons/lang3/function/Functions.java
index cf8309f8f..8d9313ca5 100644
--- a/src/main/java/org/apache/commons/lang3/function/Functions.java
+++ b/src/main/java/org/apache/commons/lang3/function/Functions.java
@@ -26,6 +26,21 @@
*/
public final class Functions {
+ /**
+ * Applies the {@link Function} on the object if the function is not {@code null}. Otherwise, does nothing and
+ * returns {@code null}.
+ *
+ * @param object the object to apply the function.
+ * @param function the function to apply.
+ * @param the type of the argument the function applies.
+ * @param the type of the result the function returns.
+ * @return the value the function returns if the function is not {@code null}; {@code null} otherwise.
+ * @since 3.15.0
+ */
+ public static R apply(final T object, final Function function) {
+ return function != null ? function.apply(object) : null;
+ }
+
/**
* Starts a fluent chain like {@code function(foo::bar).andThen(...).andThen(...).apply(...);}
*
@@ -41,19 +56,4 @@ public static Function function(final Function function) {
private Functions() {
// no instances needed.
}
-
- /**
- * Applies the {@link Function} on the object if the function is not {@code null}. Otherwise, does nothing and
- * returns {@code null}.
- *
- * @param object the object to apply the function.
- * @param function the function to apply.
- * @param the type of the argument the function applies.
- * @param the type of the result the function returns.
- * @return the value the function returns if the function is not {@code null}; {@code null} otherwise.
- * @since 3.15.0
- */
- public static R apply(final T object, final Function function) {
- return function != null ? function.apply(object) : null;
- }
}
diff --git a/src/test/java/org/apache/commons/lang3/StringUtilsTrimStripTest.java b/src/test/java/org/apache/commons/lang3/StringUtilsTrimStripTest.java
index aa827ddf5..96aef4d64 100644
--- a/src/test/java/org/apache/commons/lang3/StringUtilsTrimStripTest.java
+++ b/src/test/java/org/apache/commons/lang3/StringUtilsTrimStripTest.java
@@ -111,13 +111,13 @@ public void testStripAccentsIWithBar() {
}
@Test
- public void testStripAccentsUWithBar() {
- assertEquals("U u U u", StringUtils.stripAccents("\u0244 \u0289 \u1D7E \u1DB6"));
+ public void testStripAccentsTWithStroke() {
+ assertEquals("T t", StringUtils.stripAccents("\u0166 \u0167"));
}
@Test
- public void testStripAccentsTWithStroke() {
- assertEquals("T t", StringUtils.stripAccents("\u0166 \u0167"));
+ public void testStripAccentsUWithBar() {
+ assertEquals("U u U u", StringUtils.stripAccents("\u0244 \u0289 \u1D7E \u1DB6"));
}
@Test
diff --git a/src/test/java/org/apache/commons/lang3/function/ConsumersTest.java b/src/test/java/org/apache/commons/lang3/function/ConsumersTest.java
index 47828debf..e649c25db 100644
--- a/src/test/java/org/apache/commons/lang3/function/ConsumersTest.java
+++ b/src/test/java/org/apache/commons/lang3/function/ConsumersTest.java
@@ -31,22 +31,13 @@
*/
public class ConsumersTest extends AbstractLangTest {
- /**
- * Tests {@link Consumers#nop()}.
- */
- @Test
- public void testNop() {
- Stream.of("").forEach(Consumers.nop());
- //
- final Consumer> c1 = Consumers.nop();
- c1.accept(null);
- final Consumer