• 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
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

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: 26697
81
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: 73270
332
  • 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.
 
I've been selected to go to the moon! All thanks to this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic