Example usage for Java org.apache.commons.lang3 ObjectUtils fields, constructors, methods, implement or subclass
The text is from its open source code.
Null | NULL Singleton used as a null placeholder where null has another meaning. For example, in a HashMap the java.util.HashMap#get(java.lang.Object) method returns null if the Map contains null or if there is no matching key. |
T | clone(final T obj) Clone an object. |
T | cloneIfPossible(final T obj) Clone an object if possible. This method is similar to #clone(Object) , but will return the provided instance as the return value instead of null if the instance is not cloneable. |
int | compare(final T c1, final T c2) Null safe comparison of Comparables. |
int | compare(final T c1, final T c2, final boolean nullGreater) Null safe comparison of Comparables. |
T | defaultIfNull(final T object, final T defaultValue) Returns a default value if the object passed is null . ObjectUtils.defaultIfNull(null, null) = null ObjectUtils.defaultIfNull(null, "") = "" ObjectUtils.defaultIfNull(null, "zz") = "zz" ObjectUtils.defaultIfNull("abc", *) = "abc" ObjectUtils.defaultIfNull(Boolean.TRUE, *) = Boolean.TRUE |
boolean | equals(final Object object1, final Object object2) Compares two objects for equality, where either one or both objects may be null . ObjectUtils.equals(null, null) = true ObjectUtils.equals(null, "") = false ObjectUtils.equals("", null) = false ObjectUtils.equals("", "") = true ObjectUtils.equals(Boolean.TRUE, null) = false ObjectUtils.equals(Boolean.TRUE, "true") = false ObjectUtils.equals(Boolean.TRUE, Boolean.TRUE) = true ObjectUtils.equals(Boolean.TRUE, Boolean.FALSE) = false |
T | firstNonNull(final T... values) Returns the first value in the array which is not null . |
int | hashCode(final Object obj) Gets the hash code of an object returning zero when the object is null . ObjectUtils.hashCode(null) = 0 ObjectUtils.hashCode(obj) = obj.hashCode() |
int | hashCodeMulti(final Object... objects) Gets the hash code for multiple objects. This allows a hash code to be rapidly calculated for a number of objects. |
String | identityToString(final Object object) Gets the toString that would be produced by Object if a class did not override toString itself. |
T | mode(final T... items) Find the most frequently occurring item. |
boolean | notEqual(final Object object1, final Object object2) Compares two objects for inequality, where either one or both objects may be null . ObjectUtils.notEqual(null, null) = false ObjectUtils.notEqual(null, "") = true ObjectUtils.notEqual("", null) = true ObjectUtils.notEqual("", "") = false ObjectUtils.notEqual(Boolean.TRUE, null) = true ObjectUtils.notEqual(Boolean.TRUE, "true") = true ObjectUtils.notEqual(Boolean.TRUE, Boolean.TRUE) = false ObjectUtils.notEqual(Boolean.TRUE, Boolean.FALSE) = true |
String | toString(final Object obj, final String nullStr) Gets the toString of an Object returning a specified text if null input. ObjectUtils.toString(null, null) = null ObjectUtils.toString(null, "null") = "null" ObjectUtils.toString("", "null") = "" ObjectUtils.toString("bat", "null") = "bat" ObjectUtils.toString(Boolean.TRUE, "null") = "true" |
String | toString(final Object obj) Gets the toString of an Object returning an empty string ("") if null input. ObjectUtils.toString(null) = "" ObjectUtils.toString("") = "" ObjectUtils.toString("bat") = "bat" ObjectUtils.toString(Boolean.TRUE) = "true" |