aspose file tools*
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
Author

vector can use like hashtable

Nilima vyas
Greenhorn

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 value.how 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
Sheriff

Joined: Oct 13, 2005
Posts: 38363
    
  23
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: http://aspose.com/file-tools
 
subject: vector can use like hashtable