Post a Job  |   Ask a Question?   |   Already registered? login or register
ram sai
02/04/2016 08:01 PM

Core Java : Spring Today's class properties collection

friends can anyone helpe me..if properties collection can store only String as Key and Value, so why the method containsKey(Object object) is expecting object as a parameter.?it should expect a String as a parameter right...?and what is the difference between conatins(Object object) method and containsKey(Object object) method.? can anyone help me..? thanks in adance..
Spam    2 Comments

03/04/2016 22:28:08
Friends...Could anyone help me on this..?

03/04/2016 23:36:27
Properties class extends from Hashtable Hashtable implents from Map (I) Map has provided method boolean containsKey(Object object) which is overriden in Hashtable and inherited in Properties class so we can use it. public boolean contains(Object object) This method checks for given object is present as value in key-value pair and if present returns true. public boolean containsKey(Object object) This method checks for given object is present as key in key-value pair. Hashtable contains following methods to be used: public boolean contains(Object object) public boolean containsKey(Object object) public boolean containsValue(Object object) , contains(Object object) : It is method provided by Collection (I) If specified object there is associated key present in Hashtable it returns true. ie here we are passing parameter as value and checking for avaibility of this value (object) for any key of key-value pair containsKey(Object object) It is method provided by Map (I) Returns true if map contains specified object as key ie. here we r passing key as parameter to check if this object is present as key in key value pair Properties (C) extends from Hashtable (C) Hashtable (C) extends from Dictionary (C) and implements Map (I) Map (I) provided method called public boolean containsKey(Object object) Hashtable has overridden method public boolean containsKey(Object object) Hashtable is super class for Properties class so Properties class inherits all methods of Hashtable so we can even use boolean containsKey(Object object) for Properties class.

Languages :