Java Collection Tutorial - Java Hashtable(Map <? extends K ,? extends V > t) Constructor


Hashtable(Map <? extends K ,? extends V > t) constructor from Hashtable has the following syntax.

public Hashtable(Map <? extends K ,? extends V> t)


In the following code shows how to use Hashtable.Hashtable(Map <? extends K ,? extends V > t) constructor.

/*w ww.  j a v a 2s.  c  o m*/
import java.util.Hashtable;

public class Main {
   public static void main(String args[]) {

      Hashtable<Integer, String> htable = new Hashtable<Integer, String>();

      // put values into the table
      htable.put(1, "A");
      htable.put(2, "B");
      htable.put(3, "C");
      htable.put(4, "from");

      Hashtable<Integer, String> htable1 = new Hashtable<Integer, String>(htable);