java.util.Hashtable.putAll() 方法


java.util.Hashtable.putAll() 方法

package com.codingdict;

import java.util.*;

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

      // create hash table
      Hashtable htable1 = new Hashtable();

      // create Map
      Map map = new HashMap();

      // put values in map
      map.put("1","TP");
      map.put("2","IS");
      map.put("3","BEST");

      System.out.println("Initial hash table value: "+htable1);
      System.out.println("Map values: "+map);

      // put map values in table
      htable1.putAll(map);
      System.out.println("Hash table value after put all: "+htable1);
   }    
}