NullUtil
public
class
NullUtil
extends Object
java.lang.Object
|
↳ |
com.android.tradefed.util.NullUtil
|
A class with utility functions to help with dealing with null
Summary
Public methods |
static
boolean
|
allNull(Object... objs)
Checks if all objects are null.
|
static
int
|
countNonNulls(Object... objs)
Counts non-null objects in the passed set
|
static
int
|
countNulls(Object... objs)
Counts null objects in the passed set
|
static
boolean
|
isHomogeneousSet(Object... objs)
Check if every object is null, or every object is non-null.
|
static
boolean
|
singleNonNull(Object... objs)
Checks if exactly one object is non-null.
|
Public constructors
NullUtil
public NullUtil ()
Public methods
allNull
public static boolean allNull (Object... objs)
Checks if all objects are null. Uses short-circuit logic, so may be more efficient than
countNonNulls(Object)
for sets of many objects.
Returns |
boolean |
false if any passed objects are non-null. true otherwise.
In particular, returns true of no objects are passed.
|
countNonNulls
public static int countNonNulls (Object... objs)
Counts non-null
objects in the passed set
countNulls
public static int countNulls (Object... objs)
Counts null
objects in the passed set
isHomogeneousSet
public static boolean isHomogeneousSet (Object... objs)
Check if every object is null, or every object is non-null. Uses short-circuit logic, so may
be more efficient than countNulls(Object)
and countNonNulls(Object)
for sets of many objects.
Returns |
boolean |
true if every object is null or if every object is
non-null . false otherwise.
|
singleNonNull
public static boolean singleNonNull (Object... objs)
Checks if exactly one object is non-null. Uses short-circuit logic, so may be more efficient
than countNonNulls(Object)
for sets of many objects.
Returns |
boolean |
true if there is exactly one non-null object in the list.
false otherwise.
|