43
Working in c# i've found very useful two static methods of the String class :
i can't find a valid surrogate in Java, is there something similar ?
Actually i have translated the two methods in this way :
public static boolean isNullOrEmpty(String a) {
return a == null || a.isEmpty();
}
public static boolean isNullOrWhiteSpace(String a) {
return a == null || (a.length() > 0 && a.trim().length() <= 0);
}
Is this the best way to translate these methods in Java ? What is the best way to translate these two methods in Java ?