• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Chreating an array of vectors

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 27287
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 76102
362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Turning a List to an array is quite easy. A similar question is being discussed at the moment here.
 
reply
    Bookmark Topic Watch Topic
  • New Topic