You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2020/12/28 21:41:17 UTC

[GitHub] [commons-lang] bindul commented on a change in pull request #684: [LANG-1634] Add ObjectUtils #applyIfNonNull and #applyFirstNonNull

bindul commented on a change in pull request #684:
URL: https://github.com/apache/commons-lang/pull/684#discussion_r549495161



##########
File path: src/main/java/org/apache/commons/lang3/ObjectUtils.java
##########
@@ -226,6 +227,62 @@ public static boolean anyNotNull(final Object... values) {
         return firstNonNull(values) != null;
     }
 
+    /**
+     * <p>
+     * Invokes the given {@code consumer's} {@link Consumer#accept(Object)} with the first {@code non-null} value from
+     * {@code objects}. If all the values are null, the consumer is not invoked.
+     * </p>
+     *
+     * <p>
+     * The caller is responsible for thread-safety and exception handling of consumer.
+     * </p>
+     *
+     * <pre>
+     * ObjectUtils.applyIfNonNull(bean::setValue, null)                 - setValue not invoked

Review comment:
       Corrected, thanks.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org