「Java」java.util.TreeMap.putAll()の使い方
javaコード
import java.util.*;
public class TreeMapDemo {
public static void main(String[] args) {
TreeMap<Integer, String> treemap = new TreeMap<Integer, String>();
TreeMap<Integer, String> tmp = new TreeMap<Integer, String>();
treemap.put(2, “大崎");
treemap.put(1, “品川");
treemap.put(3, “大井町");
treemap.put(6, “川崎");
treemap.put(5, “横浜");
tmp.put(1, “changfa01");
tmp.put(2, “changfa02");
tmp.put(73, “changfa03");
System.out.println(“変更前: “+ treemap);
treemap.putAll(tmp);
System.out.println(“変更後: “+ treemap);
}
}