Java Map convert to Hashtable
import java.util.Enumeration; import java.util.HashMap; import java.util.Hashtable; import java.util.Map; public class Main { public static void main(String[] args) { Map<String, String> hMap = new HashMap<String, String>(); hMap.put("1", "CSS"); hMap.put("2", "HTML"); hMap.put("3", "Java"); Hashtable<String, String> ht = new Hashtable<String, String>(); ht.put("1", "REPLACED !!"); ht.put("4", "demo2s.com"); System.out.println("Hash table"); Enumeration<String> e = ht.elements(); while (e.hasMoreElements()){ System.out.println(e.nextElement()); } /*from w w w. j ava 2 s . c om*/ ht.putAll(hMap); e = ht.elements(); System.out.println(); System.out.println("Hash table"); while (e.hasMoreElements()){ System.out.println(e.nextElement()); } } }