Hey I'm in the middle of creating an aplication which basicly takes in information from the user and stores it in a database. I thought the easiest way of doing that would be to save it in a vector and of sorts and then save it to the database. The aplication must store information about cars and so I thought the easiest way of doing it would be by having an array with each field of the database saved within it and embed this in a vector which could expand for each car added.. Only thing is I haven't really covered how to do this in college and was wondering if anybody knew of any ressources which might be able explain the process to me.. Any help would be greatly appreciated. Thanks, Rick.
Joined: Apr 15, 2008
First question why do you need vector. IF your application is not multithreaded use arraylist.You can put an arraylist or array in an Arraylist .
I would recommend instead of using newList object create a Car class with all the properties in it . save the data in Car object and add it to the list.
If you want to save information about a car, the natural thing to do would be to create a Car class to store that information. Creating an array would not make sense in Java. You could certainly have a List of Car objects.
Joined: Oct 13, 2005
Turning a List to an array is quite easy. A similar question is being discussed at the moment here.