List of utility methods to do Type Coalesce
T | coalesce(T... args) coalesce if (args == null) return null; for (T obj : args) { if (obj != null) return obj; return null; |
T | coalesce(T... objects) Returns the first object in the supplied list of objects that isn't null. for (int i = 0; i < objects.length; i++) if (objects[i] != null) return objects[i]; return null; |
T | coalesce(T... objs) Returns first non null object or null if all objects are null for (T o : objs) { if (o != null) { return o; return null; |
T | coalesce(T... tests) Returns the first non-null value in the passed array if (tests != null) { for (int i = 0; i < tests.length; i++) { if (notNull(tests[i])) { return tests[i]; return null; ... |
T | coalesce(T... ts) coalesce for (T t : ts) { if (t != null) return t; return null; |
T | coalesce(T... values) Returns the first non- null value among the given values . return firstNonNull(values);
|
String | coalesceString(String... objects) coalesce String for (int i = 0; i < objects.length; i++) { if (!isEmptyTrim(objects[i])) { return objects[i].trim(); return null; |