@Test public void testHashcode() { assertEquals(new CompoundObjectId(new HashMap<>()), new CompoundObjectId(new HashMap<>())); Map<String, Object> ids1 = new HashMap<>(); ids1.put("id1", new Integer(1)); ids1.put("id2", "2"); CompoundObjectId objectId1 = new CompoundObjectId(ids1); CompoundObjectId objectId2 = new CompoundObjectId(ids1); assertEquals(objectId1.hashCode(), objectId2.hashCode()); Map<String, Object> ids3 = new HashMap<>(); ids3.put("id1", new Integer(1)); ids3.put("id2", "2"); CompoundObjectId objectId3 = new CompoundObjectId(ids3); assertEquals(objectId1.hashCode(), objectId3.hashCode()); assertNotEquals(objectId1.hashCode(), new CompoundObjectId(new HashMap<>())); Map<String, Object> ids4 = new HashMap<>(); ids4.put("id1", new Integer(1)); ids4.put("id2", "22"); CompoundObjectId objectId4 = new CompoundObjectId(ids4); assertNotEquals(objectId1.hashCode(), objectId4.hashCode()); }
@Override public int hashCode() { return id.hashCode(); }
CompoundObjectId extends BaseObjectId { @Override public int hashCode() { return id.hashCode(); } }
CompoundObjectId extends BaseObjectId { @Override public int hashCode() { return id.hashCode(); } CompoundObjectId(Map<String, Object> id); }
CompoundObjectId extends BaseObjectId { @Override public int hashCode() { return id.hashCode(); } CompoundObjectId(Map<String, Object> id); @Override Object get(String attributeName); @Override Object get(); @Override int size(); @Override String toString(); @Override boolean equals(Object object); @Override int hashCode(); static String mapToString(Map<String, Object> m); }
CompoundObjectId extends BaseObjectId { @Override public int hashCode() { return id.hashCode(); } CompoundObjectId(Map<String, Object> id); @Override Object get(String attributeName); @Override Object get(); @Override int size(); @Override String toString(); @Override boolean equals(Object object); @Override int hashCode(); static String mapToString(Map<String, Object> m);  }