わかりました私はこのコードを持っています:
TreeMap<DateTime, Integer> tree2 = getDatesTreeMap();
DateTime startx = new DateTime(startDate.getTime());
DateTime endx = new DateTime(endDate.getTime());
boolean possible = false;
int testValue = 0;
//produces submap
Map<DateTime, Integer> nav = tree2.subMap(startx, endx);
for (Integer capacity : tree2.subMap(startx, endx).values()) {
//Provides an insight into capacity accomodation possibility
//testValue++;
terminals = 20;
if(capacity >= terminals)
possible = true;
else if(capacity < terminals)
possible = false;
}
if(possible == true)
{
for (Integer capacity : tree2.subMap(startx, endx).values()) {
{
capacity -= terminals;
//not sure what to do
}
}
}else{
}
return possible;
サブマップの日付範囲をチェックします。次に、これらの日付の値 (ところでキー) が端末 (予約番号) に対応できるかどうかを確認し、そうであれば、現在マップにある容量からそれを差し引きます。startx と endx の間のすべての日付のマップの容量を値で更新する方法がわかりません
capacity -= terminals;
ありがとう、 :)