I have a structure something like this:
|----child obj 2
|---- child obj ---|----child obj 2
Account ---|---- child obj--- |----child obj 2
|---- child obj ---|----child obj 2
|----child obj 2
Diagram isn't the best but.. I want to be able to dynamically update the child objects of the main Account
object. There can be n number of child objects. The only way I know to do that now is to store the child objects in a data structure like a hashmap, update what i need to, then put the child object back into the hashmap.
How can I do this more efficiently?
Some example code
public class Account {
//getters and setters
ArrayList <ChildObj> listOfChildObjs = new ArrayList();
}
public class childObj {
//getters and setters
ArrayList <ChildObj2> listOfChildObj2s = new ArrayList();
}
public class childObj2 {
//getters and setters
}