builder for HashMap

前端 未结 15 2242
迷失自我
迷失自我 2020-11-30 00:17

Guava provides us with great factory methods for Java types, such as Maps.newHashMap().

But are there also builders for java Maps?

HashM         


        
15条回答
  •  一生所求
    2020-11-30 00:57

    HashMap is mutable; there's no need for a builder.

    Map map = Maps.newHashMap();
    map.put("a", 1);
    map.put("b", 2);
    

提交回复
热议问题