更新时间:2022-12-26 17:01:23
你可以这样做:
Map<String, Integer> hashMap = new HashMap<String, Integer>() {{ put("One", 1); put("Two", 2); put("Three", 3); }};
在一条语句中添加多个条目一个HashMap一次
在一个语句中一次向 HashMap 添加多个条目
在一条语句中添加多个约束