mirror of https://github.com/noisymime/Arduino.git
Introduce ObjectUtils class
This commit is contained in:
parent
355d40ae76
commit
8a1cf335ad
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue