Java Utililty Methods Type Coalesce

List of utility methods to do Type Coalesce

Description

The list of methods to do Type Coalesce are organized into topic(s).

Method

Ecoalesce(E... objects)
Returns the first non-null object that is passed in.
for (E object : objects) {
    if (object != null) {
        return object;
return null;
Ocoalesce(final O... values)
Returns the first non-null value in the set
if (null != values) {
    for (O value : values) {
        if (null != value) {
            return value;
return null;
...
Stringcoalesce(final String... strings)
coalesce
for (String str : strings) {
    if (str != null) {
        return str;
return null;
Tcoalesce(final T eitherThis, final T orThat)
First non-null value.
return eitherThis != null ? eitherThis : orThat;
Tcoalesce(final T... argv)
coalesce
for (T i : argv) {
    if (i != null) {
        return i;
return null;
Tcoalesce(final T... objects)
Returns the first non-null object of the argument list, or null if there is no such element.
for (final T object : objects) {
    if (object != null) {
        return object;
return null;
Tcoalesce(final T... ts)
Returns the first non null argument given or null if non of the arguments are non null.
for (final T t : ts) {
    if (t != null) {
        return t;
return null;
floatcoalesce(float... p)
SQL-like coalescing using isReal()
for (float v : p) {
    if (isReal(v)) {
        return v;
return p[p.length - 1];
Objectcoalesce(Object src, Object defaultValue)
coalesce
return null != src ? src : defaultValue;
Objectcoalesce(Object... args)
Coalesce all of the arguments passed to this function and return the first non-null argument passed.
for (int i = 0; i < args.length; i++)
    if (args[i] != null)
        return args[i];
return null;