我在以下代码中得到 NullPointerException :
private Map<String,List<Entry>> Days;
private void intializeDays() {
//Iterate over the DayOfWeek enum and put the keys in Map
for(DayOfWeek dw : EnumSet.range(DayOfWeek.MONDAY,DayOfWeek.SUNDAY)){
List<Entry> entries = null;
Days.put(dw.toString().toLowerCase(),entries);
}
}
我认为是因为
List<Entry> entries = null;
但是如何创建一个空列表并将其添加到地图中?