Introduce ObjectUtils class

This commit is contained in:
s17t.net 2012-08-20 00:05:02 +02:00
parent 355d40ae76
commit 8a1cf335ad
1 changed files with 13 additions and 0 deletions

View File

@ -0,0 +1,13 @@
package processing.app;
public class ObjectUtil {
public static boolean isNull(Object o) {
return o == null;
}
public static <T> T defaultIfEmpty(T obj, T defaultObj) {
if (isNull(obj)) return defaultObj;
return obj;
}
}