Java Utililty Methods String Equal

List of utility methods to do String Equal

Description

The list of methods to do String Equal are organized into topic(s).

Method

booleanareEqual(String expected, String actual)
are Equal
return expected == actual || (expected != null && expected.equals(actual));
booleanareEqual(String s1, String s2)
are Equal
if (s1 == null && s2 == null) {
    return true; 
} else if (s1 == null && s2 != null) {
    return false;
} else {
    return s1.equals(s2);
booleanareEqual(String s1, String s2)
are Equal
return s1 != null ? s1.equals(s2) : s2 == null;
booleanareEqual(String s1, String s2)
are Equal
return toString(s1).equalsIgnoreCase(toString(s2));
booleanareEqual(String seq1, String seq2)
are Equal
return trim(seq1).equals(trim(seq2));
booleanareEqual(String str1, String str2)
are Equal
return (str1 == null && str2 == null) || (str1 != null && str1.equals(str2))
        || (str2 != null && str2.equals(str1));
booleanareEqual(String string1, String string2)
Checks two string instances for equality, allowing for null in either or both strings.
return (compareTo(string1, string2) == 0);
booleanareEqual(String string1, String string2)
Compara doua stringuri
return string1 == null ? (string2 == null ? true : false)
        : (string2 == null ? false : string1.equals(string2));
booleanareEqual(String thisString, String thatString)
are Equal
if (thisString == null) {
    return thatString == null;
} else {
    return thisString.equals(thatString);
booleanareEqualConstantTime(String a, String b)
are Equal Constant Time
boolean equal = true;
if (a.length() != b.length()) {
    equal = false;
for (int i = 0; i < a.length(); i++) {
    if (a.charAt(i % a.length()) != b.charAt(i % b.length())) {
        equal = false;
return equal;