Created
June 27, 2015 09:13
-
-
Save ParkSangGwon/29025a812d135c5d4d76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ObjectUtils { | |
public static boolean isEmpty(Object s) { | |
if (s == null) { | |
return true; | |
} | |
if ((s instanceof String) && (((String)s).trim().length() == 0)) { | |
return true; | |
} | |
if (s instanceof Map) { | |
return ((Map<?, ?>)s).isEmpty(); | |
} | |
if (s instanceof List) { | |
return ((List<?>)s).isEmpty(); | |
} | |
if (s instanceof Object[]) { | |
return (((Object[])s).length == 0); | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment