diff --git a/src/java/org/apache/commons/lang/ObjectUtils.java b/src/java/org/apache/commons/lang/ObjectUtils.java index 2bdcb1c30..34fff81f3 100644 --- a/src/java/org/apache/commons/lang/ObjectUtils.java +++ b/src/java/org/apache/commons/lang/ObjectUtils.java @@ -90,6 +90,37 @@ public static Object defaultIfNull(Object object, Object defaultValue) { return object != null ? object : defaultValue; } + /** + *
Returns the first value in the array which is not null
.
+ * If all the values are null
or the array is null
+ * or empty then null
is returned.
+ * ObjectUtils.firstNonNull(null, null) = null + * ObjectUtils.firstNonNull(null, "") = "" + * ObjectUtils.firstNonNull(null, null, "") = "" + * ObjectUtils.firstNonNull(null, "zz") = "zz" + * ObjectUtils.firstNonNull("abc", *) = "abc" + * ObjectUtils.firstNonNull(null, "xyz", *) = "xyz" + * ObjectUtils.firstNonNull(Boolean.TRUE, *) = Boolean.TRUE + * ObjectUtils.firstNonNull() = null + *+ * + * @param values the values to test, may be
null
or empty
+ * @return the first value from values
which is not null
,
+ * or null
if there are no non-null values
+ */
+ public static Compares two objects for equality, where either one or both
* objects may be null
.
Returns the first passed value which is not null
or
- * null
otherwise.
- * ObjectUtils.firstNonNull(null, null) = null - * ObjectUtils.firstNonNull(null, "") = "" - * ObjectUtils.firstNonNull(null, null, "") = "" - * ObjectUtils.firstNonNull(null, "zz") = "zz" - * ObjectUtils.firstNonNull("abc", *) = "abc" - * ObjectUtils.firstNonNull(null, "xyz", *) = "xyz" - * ObjectUtils.firstNonNull(Boolean.TRUE, *) = Boolean.TRUE - * ObjectUtils.firstNonNull() = null - *- * - * @param values the values to test, may be
null
or empty
- *
- * @return The first value from values
which is not
- * null
or null
otherwise.
- */
- public static