Java String isNotEmpty() Utility Method

Java String Utility Methods


This page contains the source code of 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;
}


Comments