Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Vector vs Hashtable

 
Anna Hays
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, peopel keep saying they use Vectors for storing their locked / deleted /whatever records and its associated cookies. But I can seem to understand why cos no one actually detailing how they store their data. I think there is a need to store both record numbers and lock cookies. So I need to use the wrappers for both key and element.
How do people get away with Vectors?? I am very curious!
Thanks
 
Jon Pengelly
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anna,
I think people have used Vector (or ArrayList with the synchronized wrapper) for the database record cache usually. I think most people have used a HashMap to hold the locked record details. I am currently doing this.
Jonathan
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anna,
Only some of the assignments have lock cookies - some people don't have them in their requirements. If you look at the question "How may assignments are there? (What is an NX assignment?)" in the JavaRanch Sun Certified Java Developer Faq, you will see some of the known signatures for the unlock method for the UrlyBird assignment.
If you didn't have a requirement for cookies, and if you were building thin clients (three tier) ( ) then you might feel that you only need a simple Vector.
But on that topic, those using Vector's may be interested in reading Peter den Haan's comments on why Vector and Hashtable should not be used.
Regards, Andrew
[ February 20, 2004: Message edited by: Andrew Monkhouse ]
 
Anna Hays
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh I just think no one talks about using Hashtable and the like but only Vector, so I think I missed something. Now I know I am not in the wrong direction. Thanks guys!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic