I want to compare two strings for equality when either or both can be null.
null
So, I can\'t simply call .equals() as it can contain null<
.equals()
null<
This is what Java internal code uses (on other compare methods):
compare
public static boolean compare(String str1, String str2) { return (str1 == null ? str2 == null : str1.equals(str2)); }