From 27ed724caf26e0b36a3c1a1b3a4942f2cc381167 Mon Sep 17 00:00:00 2001 From: Jon Shemitz Date: Tue, 30 May 2017 17:28:35 -0700 Subject: [PATCH] Modest tweaks to IjFolder 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 --- .../facebook/buck/ide/intellij/model/folders/IjFolder.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/com/facebook/buck/ide/intellij/model/folders/IjFolder.java b/src/com/facebook/buck/ide/intellij/model/folders/IjFolder.java index c4ddac9e40a..8815e06544f 100644 --- a/src/com/facebook/buck/ide/intellij/model/folders/IjFolder.java +++ b/src/com/facebook/buck/ide/intellij/model/folders/IjFolder.java @@ -115,7 +115,8 @@ 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()); } @@ -123,8 +124,8 @@ public boolean equals(Object other) { @Override public int hashCode() { return (getPath().hashCode() << 31) - | (getWantsPackagePrefix() ? 0x8000 : 0) - | inputs.hashCode(); + ^ (getWantsPackagePrefix() ? 0x8000 : 0) + ^ inputs.hashCode(); } @Override