QuickSand
QuickSand copied to clipboard
Change == operator to .equals()
This provides optional future functionality allowing the .equals() to be overridden.
Interesting change. Could you please give a practical example on a use case for this? I am really curious
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.
But you can't override equals
for a primitive value, which is the case, right? long timesAnimationViewed, long currentDuration
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.