@Override public int hashCode() { // Keep this in sync with UnsanitizedString#hashCode so that StringData and UnsanitizedString // can be used interchangeably. return stringValue().hashCode(); } }
@Override public boolean equals(@Nullable Object other) { // TODO(user): js uses reference equality, this uses content comparison if (other instanceof StringData) { // So that StringData and UnsanitizedString can be used interchangeably. Keep this in sync // with StringData#equals. return ((StringData) other).stringValue().equals(this.getContent()); } return other instanceof UnsanitizedString && this.getContentDirection() == ((SanitizedContent) other).getContentDirection() && this.getContent().equals(((UnsanitizedString) other).getContent()); }