Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Solandra #71

Closed
wants to merge 1 commit into from

2 participants

Steven Scott Jake Luciani
Steven Scott

not important, feel free to ignore. well, the check for null is a good thing of course

Steven Scott Already using Guava, so use its hashCode() method; handle nulls to eq…
…uals() and add identity equality shortcut
fa20066
Jake Luciani tjake closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 16, 2011
  1. Already using Guava, so use its hashCode() method; handle nulls to eq…

    Steven Scott authored
    …uals() and add identity equality shortcut
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/lucandra/Pair.java
7 src/lucandra/Pair.java
View
@@ -16,13 +16,16 @@ public Pair(T1 left, T2 right)
@Override
public final int hashCode()
{
- int hashCode = 31 + (left == null ? 0 : left.hashCode());
- return 31*hashCode + (right == null ? 0 : right.hashCode());
+ return Objects.hashCode(left, right);
}
@Override
public final boolean equals(Object o)
{
+ if (o == null)
+ return false;
+ if (this == o)
+ return true;
if(!(o instanceof Pair))
return false;
Pair that = (Pair)o;
Something went wrong with that request. Please try again.