File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Chreating an array of vectors

 
rick kinirons
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Harshit Rastogi
Ranch Hand
Posts: 131
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

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.
 
Paul Clapham
Sheriff
Pie
Posts: 20203
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47300
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Turning a List to an array is quite easy. A similar question is being discussed at the moment here.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic