Skip to content

Conversation

@jeremyz23
Copy link

This provides optional future functionality allowing the .equals() to be overridden.

This provides optional future functionality allowing the .equals() to be overridden.
@juankysoriano
Copy link

Interesting change. Could you please give a practical example on a use case for this? I am really curious

@jeremyz23
Copy link
Author

Though the equality operator '==' compares equality of two expressions i.e. EqualityExpression == RelationalExpression. The '==' operator cannot be overridden. The .equals() function provides Object equality and can be overridden. This allows for optional future functionality with less code change without compromising the current behavior.

Granted this is an optional change rather than a necessary change.

@juankysoriano
Copy link

But you can't override equals for a primitive value, which is the case, right? long timesAnimationViewed, long currentDuration

@jeremyz23
Copy link
Author

jeremyz23 commented Oct 5, 2018

This is true. If the datatypes of the two primitive parameters are always primitives then the change is unnecessary. If they are ever anything else (Objects) then the .equals() method will be optimal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants