forked from I2P_Developers/i2p.i2p
add shortcut in equals() for speed
This commit is contained in:
@ -66,6 +66,7 @@ public class ByteArray implements Serializable, Comparable {
|
||||
|
||||
@Override
|
||||
public final boolean equals(Object o) {
|
||||
if (o == this) return true;
|
||||
if (o == null) return false;
|
||||
if (o instanceof ByteArray) {
|
||||
ByteArray ba = (ByteArray)o;
|
||||
|
@ -177,6 +177,7 @@ public class Certificate extends DataStructureImpl {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (object == this) return true;
|
||||
if ((object == null) || !(object instanceof Certificate)) return false;
|
||||
Certificate cert = (Certificate) object;
|
||||
return _type == cert.getCertificateType() && DataHelper.eq(_payload, cert.getPayload());
|
||||
|
@ -116,6 +116,7 @@ public class DateAndFlags extends DataStructureImpl {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (object == this) return true;
|
||||
if ((object == null) || !(object instanceof DateAndFlags)) return false;
|
||||
DateAndFlags daf = (DateAndFlags) object;
|
||||
return _date == daf._date && _flags == daf._flags;
|
||||
|
@ -83,6 +83,7 @@ public class KeysAndCert extends DataStructureImpl {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (object == this) return true;
|
||||
if ((object == null) || !(object instanceof KeysAndCert)) return false;
|
||||
KeysAndCert ident = (KeysAndCert) object;
|
||||
return DataHelper.eq(_certificate, ident._certificate)
|
||||
|
@ -137,6 +137,7 @@ public class Lease extends DataStructureImpl {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (object == this) return true;
|
||||
if ((object == null) || !(object instanceof Lease)) return false;
|
||||
Lease lse = (Lease) object;
|
||||
return DataHelper.eq(_end, lse.getEndDate())
|
||||
|
@ -324,6 +324,7 @@ public class LeaseSet extends DatabaseEntry {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (object == this) return true;
|
||||
if ((object == null) || !(object instanceof LeaseSet)) return false;
|
||||
LeaseSet ls = (LeaseSet) object;
|
||||
return DataHelper.eq(getEncryptionKey(), ls.getEncryptionKey()) &&
|
||||
|
@ -105,6 +105,7 @@ public class Payload extends DataStructureImpl {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (object == this) return true;
|
||||
if ((object == null) || !(object instanceof Payload)) return false;
|
||||
Payload p = (Payload) object;
|
||||
return DataHelper.eq(_unencryptedData, p.getUnencryptedData())
|
||||
|
@ -70,6 +70,7 @@ public class PrivateKey extends SimpleDataStructure {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) return true;
|
||||
if ((obj == null) || !(obj instanceof PrivateKey)) return false;
|
||||
return DataHelper.eq(_data, ((PrivateKey) obj)._data);
|
||||
}
|
||||
|
@ -225,6 +225,7 @@ public class RouterAddress extends DataStructureImpl {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (object == this) return true;
|
||||
if ((object == null) || !(object instanceof RouterAddress)) return false;
|
||||
RouterAddress addr = (RouterAddress) object;
|
||||
// let's keep this fast as we are putting an address into the RouterInfo set frequently
|
||||
|
@ -588,6 +588,7 @@ public class RouterInfo extends DatabaseEntry {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (object == this) return true;
|
||||
if ((object == null) || !(object instanceof RouterInfo)) return false;
|
||||
RouterInfo info = (RouterInfo) object;
|
||||
return DataHelper.eq(_identity, info.getIdentity())
|
||||
|
@ -182,6 +182,7 @@ public abstract class SimpleDataStructure extends DataStructureImpl {
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) return true;
|
||||
if ((obj == null) || !(obj instanceof SimpleDataStructure)) return false;
|
||||
return DataHelper.eq(_data, ((SimpleDataStructure) obj)._data);
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ public class TunnelId extends DataStructureImpl {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == this) return true;
|
||||
if ( (obj == null) || !(obj instanceof TunnelId))
|
||||
return false;
|
||||
return _tunnelId == ((TunnelId)obj)._tunnelId;
|
||||
|
Reference in New Issue
Block a user