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

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -