suppose i have a method that puts value into a hashtable
public void methodname(Hashtable h)
{
Hashtable h = new Hashtable()
h.put(...,...)
h.put(...,...)
h.put(...,...)
System.out.println(h.get(...).toString());
}
is it possible that to change the method such that it inserts to a TreeMap, all i need is to change Hashtable to TreeMap and the remaining code remains as it is? ie
public void methodname(TreeMap h)
{
TreeMap h = new TreeMap()
h.put(...,...)
h.put(...,...)
h.put(...,...)
System.out.println(h.get(...).toString());
}
if this is so, then we can all thank Sun for making life so easy for us.
public void methodname(Hashtable h)
{
Hashtable h = new Hashtable()
h.put(...,...)
h.put(...,...)
h.put(...,...)
System.out.println(h.get(...).toString());
}
is it possible that to change the method such that it inserts to a TreeMap, all i need is to change Hashtable to TreeMap and the remaining code remains as it is? ie
public void methodname(TreeMap h)
{
TreeMap h = new TreeMap()
h.put(...,...)
h.put(...,...)
h.put(...,...)
System.out.println(h.get(...).toString());
}
if this is so, then we can all thank Sun for making life so easy for us.