How does one instantiate an array of maps in Java?

后端 未结 8 1259
刺人心
刺人心 2020-11-30 06:34

I can declare an array of maps using generics to specify the map type:

private Map[] myMaps;

However, I can\'t figur

8条回答
  •  没有蜡笔的小新
    2020-11-30 07:08

    myMaps = new HashMap[10]();
    

    So that's Wrong

    Why not make a List of Maps instead of trying to make an array?

    List> mymaps = new ArrayList>(count);
    

提交回复
热议问题