| Author |
merging two lists inside a list
|
mohd sheriff
Greenhorn
Joined: Apr 14, 2009
Posts: 1
|
|
hi all,
i want to merge two lists inside a list
[] --> ArrayList
c1,c2,c3,c4,c5 --> different objects of the same class (eg. some customer class)
merging criteria::
[[c1,c2],[c3,c4],[c1,c5]] to [[c1,c2,c5],[c3,c4]]
also
[[c1,c2],[c2,c3],[c3,c4]] to [[c1,c2,c3,c4]]
Thing is, its like lists inside a list.
Hope you can help me implementing this.
Thanks
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56201
|
|
|
Please check your private messages for important administrative matters.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Hunter McMillen
Ranch Hand
Joined: Mar 13, 2009
Posts: 490
|
|
There is a method in the ArrayList API that allows you to add a Collection to the ArrayList, you can sort after that.
Hunter.
|
"If the facts don't fit the theory, get new facts" --Albert Einstein
|
 |
Artur Lorincz
Greenhorn
Joined: Jun 30, 2003
Posts: 2
|
|
Assuming that you already have the list of lists structure, what you need to do is to figure out:
1. How to traverse this structure
2. How to combine the lists that should be merged (See the hint from the previous post)
3. How to collect the merged lists into the final list (If you managed to build up the list of lists structure this is done )
Artur
|
 |
 |
|
|
subject: merging two lists inside a list
|
|
|