Skip to content

Add hashCode and equals to UniformGranularitySpec#1824

Merged
fjy merged 1 commit intoapache:masterfrom
metamx:UniformGranularitySpecHashEquals
Oct 26, 2015
Merged

Add hashCode and equals to UniformGranularitySpec#1824
fjy merged 1 commit intoapache:masterfrom
metamx:UniformGranularitySpecHashEquals

Conversation

@drcrallen
Copy link
Copy Markdown
Contributor

  • Also add hashCode != 0 to AllGranularity and NoneGranularity

This was causing some problems in unit tests in some libraries I'm developing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain why this is necessary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise All and None have a hash collision. Minor detail, and I can take it out if people are worried about the impact.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, then we can just make it 0 for none and 1 for all, if collisions are a problem. Seems unnecessary to use class name.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to -1, and 1 as per conversation on slack

* Also add hashCode != 0 to AllGranularity and NoneGranularity
@drcrallen drcrallen force-pushed the UniformGranularitySpecHashEquals branch from ce9ca54 to f432b8e Compare October 13, 2015 23:42
@himanshug
Copy link
Copy Markdown
Contributor

LGTM

@drcrallen drcrallen added this to the 0.9.0 milestone Oct 20, 2015
@fjy
Copy link
Copy Markdown
Contributor

fjy commented Oct 26, 2015

👍

fjy added a commit that referenced this pull request Oct 26, 2015
Add hashCode and equals to UniformGranularitySpec
@fjy fjy merged commit 5a082b2 into apache:master Oct 26, 2015
@drcrallen drcrallen deleted the UniformGranularitySpecHashEquals branch October 27, 2015 14:26
@gianm gianm modified the milestones: 0.8.3, 0.9.0 Dec 1, 2015
@gianm gianm mentioned this pull request Dec 4, 2015
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.

5 participants