收到此錯誤:整數不相容喬達和Java郎
incompatible types
required: java.lang.Integer
found: java.util.Map.Entry<org.joda.time.DateTime.java.lang.Integer>
,並導致錯誤的代碼:
public static void checkRange() {
DateTime startx = new DateTime(startDate.getTime());
DateTime endx = new DateTime(endDate.getTime());
//produces submap
Map<DateTime, Integer> nav = map.subMap(startx, endx);
//this is the line causing the error:
for (Integer capacity : map.subMap(startx, endx).entrySet()) {
}
}
}
我已經的startDate和結束日期定義爲日期較早的話,我在這裏將其轉換爲u可以看到DateTime。我不認爲這就是問題所在 和地圖是
public static TreeMap<DateTime, Integer> map = new TreeMap<DateTime, Integer>();
感謝,
輝煌:D錯誤已經過去非常感謝...以及我沒有清楚知道的好解釋 –