I am having a few issues implementing this. I have an ArrayList
. I have been looking for a few days now and I can't seem to find the answer anywhere:
private List<FamilyTree> Tree;
I can add new Trees
to the array
like this:
FamilyTree Generation = new FamilyTree();
Generation.add(new Tree());
I basically want to be able to move between the generations. So for example, I add a new Person to the tree
Generation.add(new Person(height, hair colour, eyes));
Then I decide, I want to add another person to the previous generation. That is to the Arraylist
Containing the current ArrayList
(not this one).
I am not sure if I am explaining my problem well so here is a diagram:
----John----Peter----Sandra----Rachel-----
/ \ | |
-Jon--Sunny---Cassie--Milo---
/ | \
Ron-Kim-Guy
So Basically, there is an initial ArrayList
of John, Peter, Sandra and Rachel. Each having their own Arraylist(s)
. Supposing I want to add to Rachel from Guy, how would I move back and forth between the separate arrays??
Thanks in advance