Java String isNotEmpty() Utility Method - Check String is Not Empty

This page contains the source code of the Java String isNotEmpty() utility method - This method checks if a CharSequence is not empty ("") and not null.

Java String isNotEmpty() Utility Method

The following String isNotEmpty() utility method checks if a CharSequence is not empty ("") and not null:

public static boolean isNotEmpty(final CharSequence cs) {
     return !isEmpty(cs);
}

public static boolean isEmpty(final CharSequence cs) {
     return cs == null || cs.length() == 0;
}

Related Utility Methods


Comments