Modifier and Type | Method and Description |
---|---|
static <T extends Cloneable> |
clone(T original)
|
static boolean |
equals(Object o1,
Object o2)
Compares two objects for equality, where either one or both objects may
be
null . |
static <T> T |
notNull(T object)
|
static <T> T |
nullValue(T value,
T ifNull)
Checks if the provided
value is null . |
public static boolean equals(Object o1, Object o2)
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
o1
- the first object, may be null
o2
- the second object, may be null
true
if the values of both objects are the samepublic static <T extends Cloneable> T clone(T original) throws RuntimeException
T
- the type of the object that will be clonedoriginal
- the original object that will be clonedoriginal
objectRuntimeException
- if clone process does not succeedCopyable
public static <T> T nullValue(T value, T ifNull) throws IllegalArgumentException
value
is null
. In this
case ifNull
is returned. If value
is not
null
value
itself is returned.T
- type of the return value and all paramtersvalue
- to check for null
ifNull
- replacement if value
is null
ifNull
if the provided value
is
null
; otherwise value
IllegalArgumentException
- if ifNull
is null
public static <T> T notNull(T object)
object
- Copyright © 2003–2021 XDEV Software. All rights reserved.