com.google.common.base.Strings.isNullOrEmpty() Java Code Examples
How to use isNullOrEmpty() method in com.google.common.base.Strings class.
More Java code examples for com.google.common.base.Strings Guava Google Core Libraries for Java.
Java Code Example 1 returns true if the given string is an empty String
import com.google.common.base.Strings;
public class StringsIsNullOrEmptyExample1 {
public static void main(String[] args) {
String emptyString = "";
boolean result = Strings.isNullOrEmpty(emptyString);
System.out.println(result);
}
}
true
Java Code Example 2 returns true if the given string is null String
import com.google.common.base.Strings;
public class StringsIsNullOrEmptyExample2 {
public static void main(String[] args) {
String nullString = null;
boolean result = Strings.isNullOrEmpty(nullString);
System.out.println(result);
}
}
true
Java Code Example 3 returns false if the given string is not empty or null String
import com.google.common.base.Strings;
public class StringsIsNullOrEmptyExample3 {
public static void main(String[] args) {
String inputString = "Simple Solution";
boolean result = Strings.isNullOrEmpty(inputString);
System.out.println(result);
}
}
false