Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
Modest tweaks to IjFolder
Browse files Browse the repository at this point in the history
Summary:
1) .equals() now compares hashCode() first
2) .hashCode() uses xor, not or

Test Plan: `buck test //test/com/facebook/buck/ide/intellij/projectview && buck test //test/com/facebook/buck/ide/intellij`

Reviewed By: styurin

fbshipit-source-id: a4039ea
  • Loading branch information
JonShemitz authored and facebook-github-bot committed May 31, 2017
1 parent 5039873 commit 27ed724
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,17 @@ public boolean equals(Object other) {
}

IjFolder otherFolder = (IjFolder) other;
return getPath().equals(otherFolder.getPath())
return (hashCode() == otherFolder.hashCode())
&& getPath().equals(otherFolder.getPath())
&& (getWantsPackagePrefix() == otherFolder.getWantsPackagePrefix())
&& getInputs().equals(otherFolder.getInputs());
}

@Override
public int hashCode() {
return (getPath().hashCode() << 31)
| (getWantsPackagePrefix() ? 0x8000 : 0)
| inputs.hashCode();
^ (getWantsPackagePrefix() ? 0x8000 : 0)
^ inputs.hashCode();
}

@Override
Expand Down

0 comments on commit 27ed724

Please sign in to comment.