Hey All: Okay, I'm going over everything and I'm having a tough time justifying all of my decisions as far as which type of collection I used under different circumstances. There are some few times when I used a certain one for a certain purpose, but more often than not there was not a compelling reason to use one over the other, so I just used Vector generally (because I'm most familiar with it). There are several places where it seems you could use most any collection. For instance, my lockHolder. I made it a Vector, but there's not a particularly compelling reason why. I mean, it works! It seems like it would have worked equally well, with most any other collection. Any profound insights on this one? With Respect, matt
Java in a Nutshell: "Vector is quite similar to the ArrayList class, except that the methods of Vector are synchronized, which makes them thread-safe but increases the overhead of calling them. If you need thread safety or need to be compatible with Java 1.0 or Java 1.1 use Vector, otherwise use ArrayList." It says the same for Hashtable vs. HashMap.
Another option would be to use one of the Collections.synchronizedXxx() methods to synchronize your collection.
Joined: Mar 23, 2000
If you do use the Collections framework, then deciding upon required behaviors will help you to decide whether to use a Set, List, Map, etc. For example, are duplicate entries allowed, do you want to look up an object based upon some sort of key (perhaps a record #), etc.
Regarding the synchronization: Keep in mind that you only need synchronized collections if concurrent modification can occur to the collection. If you do your synchronization within your methods and no concurrent modifications can happen, use the unsynch'ed ones. Rainer