java - Equivalent of Guava's Strings.isNullOrEmpty() for Long, Integer, etc -


is there .isnullorzero() in util libs guava java boxed numeric primitive types?

a integer, long can not empty if not null; can 0 in case. integer or long can write -

public static boolean isnullorzero( final object obj) {     if(null == obj) return true;     if( obj instanceof integer ){       integer = (integer) obj;       return (i == 0);    }      if( obj instanceof long ){       long l = (long) obj;       return (l == 0);    }  } 

for collection, if not null can empty. can write own isnullorempty() method -

public static boolean isnullorempty( final collection< ? > collection ) {     return (collection == null || collection.isempty() ); } 

Comments

Popular posts from this blog

c# - How can I have the VS Debugger break in the correct location for exceptions thrown in Async methods in a Console App? -

php - Issues outputting data after prepared statement with loops -

javascript - How to pass a property by reference -