File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes vector can use like hashtable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "vector can use like hashtable" Watch "vector can use like hashtable" New topic

vector can use like hashtable

Nilima vyas

Joined: Mar 06, 2008
Posts: 2
i have problem that in place of hashtable i used vector since sequence of my parameter are get disturb since of using hashtable, i used vector so i can mantain the sequence of parameter, but when two parameter have same value using vector , giving list of values for each parameter , i requried the same that each parameter must have only one can i manage thatmy both problem sequence and each key have single value can solve using vector and anybody else.
pls reply me as soon as possible
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46412
Patience, patience.

Have you read the Java Tutorial about collections? Please do.

Both Hashtable and Vector are regarded as less efficient and you usually get better performance with HashMap and ArrayList. If you insist you need a key an a value, you will need a Map. But I don't think you do. Read the descriptions of the interfaces, particularly at the beginning, and see what a Set is, what a List is, and what a Map is.
Do you need to maintain insertion order? Do you need to eliminate duplicates? Do you need to link keys with values? [Have you got a telephone book? That links "keys" to "values" where the name is the "key" and the phone number the "value."]
When you have answers to those questions, you will know what sort of Collection you actually need. Then you can look through the implementations in the tutorial and find which best suits you. There might be combinations; there is, for example, a combination of Links and Hashes and a Set, which might be useful for your purposes.
I agree. Here's the link:
subject: vector can use like hashtable
It's not a secret anymore!