Wednesday, April 2, 2008

java.util.Properties VS HashMap

java.util.Properties

----------------------------

 

Properties is a special case of Hashtable, holding only Strings as keys and values

The Properties can be saved to a stream or loaded from a stream

Each key and its corresponding value in the property list is a string.

 

Properties inherits from Hashtable- 
java.lang.Object
  extended byjava.util.Dictionary
      extended byjava.util.Hashtable
          extended byjava.util.Properties

 

 Object

setProperty(String key, String value)
          Calls the Hashtable method put.

 

 

 

 

HashMap:

---------------------

 

Both entries are object not string and it has rich set of Collection Handling API

 

put(Object key, Object value)
          Associates the specified value with the specified key in this map.

No comments:

Post a Comment