Collection Question

Chris Rotberg <[email protected]>
Newsgroups gmane.comp.java.sun.kvm
Message-ID <[email protected]>
I currently have a Vector that I use to store XML type Strings. I loop
through and read the Id of each using String searches. The searching is
starting to slow as the list increases and I want to optimize it.

I am considering these two approaches and wants some opinons

1. Create a class that has a int Id and a value String and then add that to
the vector and look for specific Id before I read the String
2. Create a HashTable and use the int Id as a key (does key allow
duplicates) and then look for the specific Id before I read the String

Question: Is a custom class in a Vector more overhead that a HashTable with
keys and Strings and which is faster

Thanks



===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff KVM-INTEREST".  For general help, send email to
[email protected] and include in the body of the message "help".
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.