Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement equals() and hashCode(), since we've implemented compareTo.
  • Loading branch information
aadnk committed Nov 20, 2012
1 parent d4d763a commit a849c38
Showing 1 changed file with 19 additions and 0 deletions.
Expand Up @@ -32,6 +32,7 @@
import com.comphenix.protocol.injector.PrioritizedListener;
import com.comphenix.protocol.reflect.FieldAccessException;
import com.comphenix.protocol.reflect.FuzzyReflection;
import com.google.common.base.Objects;
import com.google.common.primitives.Longs;

/**
Expand Down Expand Up @@ -447,4 +448,22 @@ public int compareTo(AsyncMarker o) {
else
return Longs.compare(getNewSendingIndex(), o.getNewSendingIndex());
}

@Override
public boolean equals(Object other) {
// Standard equals
if (other == this)
return true;
if (other == null)
return false;
if (other instanceof AsyncMarker)
return Objects.equal(getNewSendingIndex(), ((AsyncMarker) other).getNewSendingIndex());

return false;
}

@Override
public int hashCode() {
return Longs.hashCode(getNewSendingIndex());
}
}

0 comments on commit a849c38

Please sign in to comment.