wood burning stoves 2.0
The moose likes Beginning Java and the fly likes core java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "core java" Watch "core java" New topic

core java

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
when we r using Vector and HashMap in real time
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
This forum (JavaRanch) is for Questions, suggestions and whining about this site. Use the other forums to ask questions about Java.

I'm moving this thread to Java in General - beginner.

"I'm not back." - Bill Harding, Twister
Sainath Veepuri
Ranch Hand

Joined: Sep 25, 2003
Posts: 49
It's a fact that Vector and HashMap fall under the collections frame work in java.
HashMap would be useful when we would like to keep a track over the objects which are being added to it.HashMap follows a key-value pair combination.HashMap is not thread safe (not synchronized). Hence the performance should be faster.

Vector is heavily synchronized, hence this should be slower, but then it's thread safe.

In context to the vector and hashmap, unless I need a key-value pair combination and performance to be faster, I would use a HashMap.
Else I would use a Vector if I'am not worried about performance, but to have it thread safe.
Hope this should give you some idea..
I agree. Here's the link: http://aspose.com/file-tools
subject: core java
It's not a secret anymore!