I have a HashMap that stores instances of a Class.
I create the instances by putting them directly into the HashMap like so:
public HashMap<String, Object> map = new HashMap<>();
public void guardarFicha(String ID, Object instanceOfClass) {
map.put(ID, instanceOfClass);
}
Is it enough to permanently delete the instance by removing its reference in the list? Like this:
public void delete(String ID) {
this.map.remove(ID);
}
Or do I need to set each instance variable of that instance to null?
Thx in advance!