Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using Vectors

 
Martin Schneider
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • 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 ]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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?
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • 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
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic