-
-
Save rightfold/458630adf4d43c8eb0e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean equals(Object anObject) { | |
if (this == anObject) { | |
return true; | |
} | |
if (anObject instanceof String) { | |
String anotherString = (String)anObject; | |
int n = count; | |
if (n == anotherString.count) { | |
char v1[] = value; | |
char v2[] = anotherString.value; | |
int i = offset; | |
int j = anotherString.offset; | |
while (n-- != 0) { | |
if (v1[i++] != v2[j++]) | |
return false; | |
} | |
return true; | |
} | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment