@Test public void testEquals() { KeyedObject ko1 = new KeyedObject("Test", "Object"); KeyedObject ko2 = new KeyedObject("Test", "Object"); assertEquals(ko1, ko2); assertEquals(ko2, ko1); ko1 = new KeyedObject("Test 1", "Object"); ko2 = new KeyedObject("Test 2", "Object"); assertFalse(ko1.equals(ko2)); ko1 = new KeyedObject("Test", "Object 1"); ko2 = new KeyedObject("Test", "Object 2"); assertFalse(ko1.equals(ko2)); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof KeyedObject)) { return false; } KeyedObject that = (KeyedObject) obj; if (!ObjectUtilities.equal(this.key, that.key)) { return false; } if (!ObjectUtilities.equal(this.object, that.object)) { return false; } return true; }
KeyedObject implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof KeyedObject)) { return false; } KeyedObject that = (KeyedObject) obj; if (!ObjectUtilities.equal(this.key, that.key)) { return false; } if (!ObjectUtilities.equal(this.object, that.object)) { return false; } return true; } }
KeyedObject implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof KeyedObject)) { return false; } KeyedObject that = (KeyedObject) obj; if (!ObjectUtilities.equal(this.key, that.key)) { return false; } if (!ObjectUtilities.equal(this.object, that.object)) { return false; } return true; } KeyedObject(Comparable key, Object object); }
KeyedObject implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof KeyedObject)) { return false; } KeyedObject that = (KeyedObject) obj; if (!ObjectUtilities.equal(this.key, that.key)) { return false; } if (!ObjectUtilities.equal(this.object, that.object)) { return false; } return true; } KeyedObject(Comparable key, Object object); Comparable getKey(); Object getObject(); void setObject(Object object); @Override Object clone(); @Override boolean equals(Object obj); }
KeyedObject implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof KeyedObject)) { return false; } KeyedObject that = (KeyedObject) obj; if (!ObjectUtilities.equal(this.key, that.key)) { return false; } if (!ObjectUtilities.equal(this.object, that.object)) { return false; } return true; } KeyedObject(Comparable key, Object object); Comparable getKey(); Object getObject(); void setObject(Object object); @Override Object clone(); @Override boolean equals(Object obj);  }