I have a array list of objects (<ArrayList> Cars
) which contains two single elements. These elements are New Car Model[name=Prius, manufacturer=Toyota, year=2001]
and New Car Model[name=Panda, manufacturer=Fiat, year=2005;]
. I would like to create a two dimensional String array (in this case String [2][3] Cars
] where to each car would correspond a set of attributes (e.g. Cars[0][2] = "2001"
). Considering that I can't change the content in the ArrayList, what methods should I use in order to create such ordered 2D array? String.Split()? What else?
![]() ![]() ![]() |
|
||
|
![]() ![]() ![]() |
Is the data in the New Car Model class in the form of a String, or is it 3 separate fields? If it's just one string, use the
otherwise just assign it to each member of the second array manually, then loop through the first array.
|
||
|