This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit 1131a0c933fc74e66012f2e4995d121e7e0de370
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sun Feb 7 10:32:58 2021 -0500

    Eat own dog food.
---
 .../java/org/apache/commons/lang3/function/Objects.java     | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/src/main/java/org/apache/commons/lang3/function/Objects.java 
b/src/main/java/org/apache/commons/lang3/function/Objects.java
index a294b2b..59d20ab 100755
--- a/src/main/java/org/apache/commons/lang3/function/Objects.java
+++ b/src/main/java/org/apache/commons/lang3/function/Objects.java
@@ -72,10 +72,7 @@ public class Objects {
      * @see java.util.Objects#requireNonNull(Object)
      */
     public static <T> @Nonnull T requireNonNull(@Nullable T value) throws 
NullPointerException {
-        if (value == null) {
-            throw new NullPointerException("The value must not be null.");
-        }
-        return value;
+        return requireNonNull(value, "The value must not be null.");
     }
 
     /**
@@ -90,13 +87,7 @@ public class Objects {
      * @see java.util.Objects#requireNonNull(Object)
      */
     public static <T> @Nonnull T requireNonNull(@Nullable T value, @Nonnull T 
defaultValue) throws NullPointerException {
-        if (value == null) {
-            if (defaultValue == null) {
-                throw new NullPointerException("The default value must not be 
null.");
-            }
-            return defaultValue;
-        }
-        return value;
+        return value == null ? requireNonNull(defaultValue) : value;
     }
 
     /**

Reply via email to