[ 
https://issues.apache.org/jira/browse/LANG-1421?focusedWorklogId=203214&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-203214
 ]

ASF GitHub Bot logged work on LANG-1421:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Feb/19 10:03
            Start Date: 24/Feb/19 10:03
    Worklog Time Spent: 10m 
      Work Description: dekelpilli commented on pull request #357: Proposal for 
LANG-1421
URL: https://github.com/apache/commons-lang/pull/357#discussion_r259612512
 
 

 ##########
 File path: src/main/java/org/apache/commons/lang3/ObjectUtils.java
 ##########
 @@ -275,6 +315,45 @@ public static boolean allNotNull(final Object... values) {
         return true;
     }
 
+    /**
+     * Checks if all values in the array are {@code nulls}.
+     *
+     * <p>
+     * If any value is not {@code null}, the array is {@code null} or the 
array is empty (contains no elements) then
+     * {@code false} is returned. If all elements in array are {@code null} 
{@code true} is returned.
+     * </p>
+     *
+     * <pre>
+     * ObjectUtils.allNull(*)                = false
+     * ObjectUtils.allNull(*, *)             = false
+     * ObjectUtils.allNull(null)             = true
+     * ObjectUtils.allNull(null, null)       = true
+     * ObjectUtils.allNull(null, *)          = false
+     * ObjectUtils.allNull(*, null)          = false
+     * ObjectUtils.allNull(*, *, null, *)    = false
+     * ObjectUtils.allNull()                 = false
+     * ObjectUtils.allNull((Object[]) null)  = false
+     * </pre>
+     *
+     * @param values  the values to test, may be {@code null} or empty
+     * @return {@code false} if there is at least one non {@code null} value 
in the array, the array is {@code null}
+     * or array contains no elements, {@code true} if all values in the array 
are {@code null}s .
+     * @since 3.9
+     */
+    public static boolean allNull(final Object... values) {
+        if (values == null || values.length == 0) {
+            return false;
+        }
+
+        for (final Object val : values) {
 
 Review comment:
   This can be replaced by `return firstNonNull(values) == null`, although then 
you're doubling up on the null check.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

            Worklog Id:     (was: 203214)
            Time Spent: 10m
    Remaining Estimate: 0h

> Add anyNull(Object ...) to ObjectUtils
> --------------------------------------
>
>                 Key: LANG-1421
>                 URL: https://issues.apache.org/jira/browse/LANG-1421
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>    Affects Versions: 3.8
>            Reporter: Sandra Parsick
>            Priority: Minor
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> We looked for 
> {code:java}
> ObjectUtils.anyNull(Object ...)
> {code}
> We found LANG-781 but when we look in the Pull Request, we found methods like 
> anyNotNull and allNotNull. 
> We would still like to add anyNull and allNull as opposite of these.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to