import java.util.HashMap;
public class Main {
public static void main(String[] args) {
// 创建一个 HashMap
HashMap<Integer, String> sites = new HashMap<>();
// 往 HashMap 添加一些元素
sites.put(1, "Google");
sites.put(2, "Jiyik");
sites.put(3, "Taobao");
System.out.println("sites HashMap: " + sites);
// 替换映射关系{1 = Google},执行替换
sites.replace(1, "Google", "Wiki"); // 返回 true
// 不存在映射关系{2 = Weibo},没有任何操作
sites.replace(2, "Weibo", "Zhihu"); // 返回 false
System.out.println("sites after replace():\n" + sites);
}
}