public static boolean isBlank ( Object o ) { if ( o instanceof CharSequence ) { CharSequence cs = ( CharSequence ) o ; return cs == null || new StringBuilder ( cs . length ( ) ) . append ( cs ) . toString ( ) . trim ( ) . isEmpty ( ) ; } if ( o instanceof Iterable ) { Iterable < ? > iter = ( Iterable < ? > ) o ; return iter == null || ! iter . iterator ( ) . hasNext ( ) ; } if ( o instanceof Iterator ) { Iterator < ? > iter = ( Iterator < ? > ) o ; return iter == null || ! iter . hasNext ( ) ; } if ( o instanceof Map ) { Map < ? , ? > map = ( Map < ? , ? > ) o ; return map == null || map . isEmpty ( ) ; } if ( o instanceof Boolean ) { Boolean bool = ( Boolean ) o ; return bool == null || bool . equals ( Boolean . FALSE ) ; } return o == null ; }
Checks if an Object is null blank Iterable blank Iterator blank Map blank CharSequence or Boolean . FALSE .