Archiviert
13
0

Implement equals() and hashCode(), since we've implemented compareTo.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2012-11-20 06:59:56 +01:00
Ursprung d4d763af94
Commit a849c38ce6

Datei anzeigen

@ -32,6 +32,7 @@ import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.injector.PrioritizedListener; import com.comphenix.protocol.injector.PrioritizedListener;
import com.comphenix.protocol.reflect.FieldAccessException; import com.comphenix.protocol.reflect.FieldAccessException;
import com.comphenix.protocol.reflect.FuzzyReflection; import com.comphenix.protocol.reflect.FuzzyReflection;
import com.google.common.base.Objects;
import com.google.common.primitives.Longs; import com.google.common.primitives.Longs;
/** /**
@ -447,4 +448,22 @@ public class AsyncMarker implements Serializable, Comparable<AsyncMarker> {
else else
return Longs.compare(getNewSendingIndex(), o.getNewSendingIndex()); 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());
}
} }