Java examples for java.util:Hashtable Operation
hashtable Clone
//package com.java2s; import java.util.Enumeration; import java.util.Hashtable; public class Main { static Hashtable hashtableClone(Hashtable ht) { if (ht == null) return null; Hashtable htresp = new Hashtable(); Enumeration e = ht.keys(); while (e.hasMoreElements()) { Object element = e.nextElement(); htresp.put(element, ht.get(element)); }/*w ww. java 2 s. co m*/ return htresp; } static Hashtable hashtableClone(Hashtable ht1, Hashtable ht2) { if (ht1 == null && ht2 == null) return null; Hashtable htresp = new Hashtable(); if (ht1 != null) { Enumeration e = ht1.keys(); while (e.hasMoreElements()) { Object element = e.nextElement(); htresp.put(element, ht1.get(element)); } } if (ht2 != null) { Enumeration e = ht2.keys(); while (e.hasMoreElements()) { Object element = e.nextElement(); htresp.put(element, ht2.get(element)); } } return htresp; } }