HashMap<String, String> of = MapUtil.of("1", "2"); HashMap<String, String> of1 = (HashMap<String, String>) MapUtil.of(new Pair[]{Pair.of("11", "2"), Pair.of("1", "2")}); Map<String, String> build = MapUtil.builder(new HashMap<String, String>()) .put("key1", "value1") .put("key3", "value3") .put("key2", "value2").build(); Map<Object, Object> colorMap = MapUtil.of(new String[][] { {"RED", "#FF0000"}, {"GREEN", "#00FF00"}, {"BLUE", "#0000FF"} }); System.out.println(build); System.out.println(of); System.out.println(of1); System.out.println(colorMap);
hutool mapUtil新建map并赋值四种常用方法
最新推荐文章于 2023-10-10 11:25:28 发布