SpreadsheetCell.hashCode()

#199 Merged at c9ebc7e
Repository
Deleted repository
Branch
default (d4920888ad04)
Repository
ControlsFX
Branch
default
Author
  1. Nicolai Parlog
Reviewers
Description

SpreadsheetCell overrides equals but not hashCode. I fixed that. And since equality was tested with instance of, I made both methods final so subclasses can not break the equals contract by overriding it. And even though I had the strong feeling that getText is not supposed to return null, I wrote both methods such that there are no NPEs.

Perhaps I should have opened a ticket but that would have been more work than to quickly fix it...

Comments (9)

  1. Nicolai Parlog author

    @eryzhikov Your comment about Objects got removed. What do you mean when you say, there's an API for that? I used Objects for calling for calling equals and hashCode on possibly null objects - is there anything more I should have used it for?

  2. Eugene Ryzhikov

    Sorry, did not see it in the hashCode for some reason :). Your pull request looks good to me. I'll let @shadzic make final decision on this one

    1. Nicolai Parlog author

      Ok, no worries. :) I'm just very curious to learn from "the big guys" and thought I overlooked something. Anyways, I'll always be very thankful for advice - especially on best practices.

      1. Jonathan Giles

        I admit I've put on some weight recently, but no need to resort to name calling :-)