Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Using Vectors

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How I can make this work:

Now I get an empty table :| I know it is caused when I clear temp vector but I dont know how to make it work the way I need..
Edit: Nice work :|
[ May 24, 2002: Message edited by: Martin Schneider ]
[ Edited by Dave to fix the smiley ]
[ May 24, 2002: Message edited by: David O'Meara ]
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
rather than clearing the Vector each time, create a new one for each use.

( add is preferred to addElement as of JDK1.2 so that it fits into the Collections Framework)
Dave
 
Martin Schneider
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks,
but I was wondering if that kind of solutions is good if I need to select many rows from db and then print those to screen? In other word are vectors right way to deal in such an issue?
 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Martin Schneider:
Thanks,
but I was wondering if that kind of solutions is good if I need to select many rows from db and then print those to screen? In other word are vectors right way to deal in such an issue?


using a Vector might be overkill, if you don't need the synchronization aspect of the Vector, then try using an ArrayList. It is the equivalent to Vector but without the overhead of the synchronization.
define "many rows" for us. To some 50 rows is many, to others 10,000 rows is many...etc. How many rows do you expect?
Jamie
 
Martin Schneider
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, so I'd say I need to print 100 rows at maximum. Another aspect that is supposed to implement is ability to modify those rows. If I use table to display rows, is there any way to let user modify information?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic