aspose file tools*
The moose likes Beginning Java and the fly likes Hashtable elements to vector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Hashtable elements to vector " Watch "Hashtable elements to vector " New topic
Author

Hashtable elements to vector

Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
Hashtable elements to vector

Hello all
I have Hashtable object that contains 3 elements
something like this :

i find it hard to understand why i can't set it right .. i tried to do :
Brian Mozhdehi
Ranch Hand

Joined: Aug 17, 2006
Posts: 81
Hi.....you want to add the HashTable objects to the Vector or the contents of the HashTable to a Vector?
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
So what you want is for each element of the Vector to contain a Hashtable with a single element? What are you trying to achieve exactly by dong that?

BTW: Why are you using Vector and Hashtable instead of the more highly recomended ArrayList (or LinkedList) and HashMap


Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
yep single element in the hashtable ( dont ask why .. work )
have to use vector ( also work )
can it be done?
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
How about :
Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
it seams that Collections.singletonMap makes me some problems
(some iternal application things ) is there aproblem to make
it pure Map(key,value)
so when i debug it will see in the vector elemnts they contain pure hashtables
can it be done ?
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
i dont know why put it fill the vector with empty values , not hashtable
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
I see what's happening. The put() method returns the value that was just added to the Hashtable. You'll have to instantiate the Hashtable and populate it on separate lines.


[ August 23, 2006: Message edited by: Garrett Rowe ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hashtable elements to vector
 
Similar Threads
Used of toString
Help with hashes...
Question about Sorting with Hashtable
How to merge two hashtables elements in another hashtable?
How to retrieve reqd. tag values