I have a class as shown below and wanted to create several instance of it where each object should be unique based on the content of map.
For this equals and hashcode functions should be specified and I'm looking a way to implement using the map.
private class A {
private Map<String, Object> map;
public A () {
this.map = new HashMap<>();
}
public void addElement (String s, Object v) {
map.put(s, v);
}
@Override public boolean equals (Object o) {
// should be on map
}
@Override public int hashCode () {
// should be on map
}
}