I have a list of arrays, like this one:
List<String[]> myList = new ArrayList<String[]>();
myList.add( new String[]{"A1","B1","C1","D1","values"} );
myList.add( new String[]{"A1","B1","C2","D1","values"} );
myList.add( new String[]{"A1","B1","C2","D2","values"} );
myList.add( new String[]{"A2","B1","C1","D1","values"} );
myList.add( new String[]{"A2","B1","C1","D2","values"} );
I need to populate an object that has dependencies with fathers, so:
- A1 has only one child, B1.
- B1 have 2 children, C1 and C2.
- C1 has 1 child, D1 that matters ...
- C2 has 2 children, D1 and D2, which matter ...
- A2 have only one child, B1 (not the same as the other)
- B1 have only one child, C1 ... etc.
Which structure do you think is better? I need the names A1, B1, etc.
I have a probe with maps, arrays, lists ... I think that the algorithm is impossible ... :(: (
Please, help!
Change explanation:
I have a ResultSet from a database containing 5 or 6 GROUP BY clauses. I have all the simple data and
I need to create a structure with text objects, for example:
Person A - Building 1 - Tower 1 - Some Text A
Person A - Building 1 - Tower 2 - Another Text
Person A - Building 2 - Tower 1 - Another one Text
Person A - Building 2 - Tower 3 - My Text
Person B - Building 1 - Tower 2 - Any Text
Person B - Building 3 - Tower 1 - A Text...
... ?