|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.evanmclean.evlib.lang.Obj
public final class Obj
Misc functions for various object related operations.
Method Summary | ||
---|---|---|
static boolean |
equals(Object lhs,
Object rhs)
Compares two objects, handling nulls. |
|
static boolean |
equalsOneOf(Object lhs,
Object... rhs)
Calls lhs.equals() for each of the other objects until one of
them returns true. |
|
static
|
ifNull(O obj,
A alt)
If the first argument is null , returns the second argument. |
|
static boolean |
notEquals(Object lhs,
Object rhs)
Compares two objects, handling nulls. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static boolean equals(Object lhs, Object rhs)
Obj.equals(null, null) = true Obj.equals(null, "") = false Obj.equals("", "") = true Obj.equals(Boolean.TRUE, "true") = false Obj.equals(Boolean.TRUE, new Boolean(true)) = true
lhs
- rhs
-
null
, or
lhs.equals(rhs)
returns true
.public static boolean equalsOneOf(Object lhs, Object... rhs)
lhs.equals()
for each of the other objects until one of
them returns true.
lhs
- The object to compare.rhs
- One or more objects to compare against for equality.
lhs.equals(rhs)
returns true
for
one of the rhs
objects specified. Returns
true
if lhs
is null and one of the
rhs
objects is null.public static <T,O extends T,A extends T> T ifNull(O obj, A alt)
null
, returns the second argument.
T
- Return type. Will be common ancestor type of the two parameters.O
- Type of the first argument.A
- Type of the second argument.obj
- The object to check.alt
- The object to return if obj
is null
.
public static boolean notEquals(Object lhs, Object rhs)
Obj.equals(null, null) = false Obj.equals(null, "") = true Obj.equals("", "") = false Obj.equals(Boolean.TRUE, "true") = true Obj.equals(Boolean.TRUE, new Boolean(true)) = false
lhs
- rhs
-
null
, or
lhs.equals(rhs)
returns true
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |