• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Any problems with Vector?

 
Reshma Das
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iam storing the data in vector. the origin , destination too gets stored in vector and passed from server to client. is there any problem with using vector ? or there is any other data structure available for it.
iam passing all the data from server to client.
my client is a thin client.
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can go for ArrayList instead of Vector for the following reason :
The non-thread-safe Java ArrayList version is 45% faster than the thread-safe Java Vector version
-- Ravindra
 
Reshma Das
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey JTable constructor accepts Vector not ArrayList. that is the main reason i used Vector.
any suggestions on it.
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your approach looks okay to me .
You could have used some other JTable constructor like
public JTable(Object[][] rowData, object[] columnNames)
and loop over a collection i.e ArrayList of objects add it to rowData , but I think
you would have to to this additional processing on the client side.
However , you can be saved these additional processing , if your method just returns
a Vector and you use a vector to initialise a JTable and display it.
-- Ravindra
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic