Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes Difference Between hashmap and Property class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Difference Between hashmap and Property class" Watch "Difference Between hashmap and Property class" New topic
Author

Difference Between hashmap and Property class

Sowm Herur
Ranch Hand

Joined: Jul 07, 2008
Posts: 32
What is the difference between Hash map and Property class?
i am aware Property class is used to read from a property file..But whey do we require a hash map?
In which scenario will we use Hash map? Please tell with an Example..of using both Property and hash map class?
Vivek Singh
Ranch Hand

Joined: Oct 27, 2009
Posts: 92
Hash Map is a Map. That contains key Value Pairs.

I am not sure about which property class you are referring to as we have java.util.Properties class?
Sowm Herur
Ranch Hand

Joined: Jul 07, 2008
Posts: 32
Yes i am referring to java.util.Property class?

In what scenarios will use Hashmap and property class?
Can you give examples and explain please?
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3825

Properties class allows String key/value pairs to read from or write to a stream. You may have have several application specific parameters to be read at the application startup you can utilize Properties class. HashMap is a collection class which allows to use key/value pairs of objects. But HashMap is identical to Hashtable (which the Properties class itself extends from) apart from few differences. Check the API documentation of those.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19674
    
  18

As Vijitha said, Properties extends Hashtable. As such, the differences are only those between HashMap and Hashtable, and the extra methods added by Properties.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference Between hashmap and Property class