質問があります。インデックスが空かどうかを指定したインデックスの ararylist を確認したい。ユーザーは、配列リスト (インデックス 0 から 6) に 7 項目のような入力ストアを持っている可能性があります。したがって、インデックス 7 が空かどうかを確認したいのですが、空の場合は RoomSelection() にループ バックします。
roomInfo(4+ xx)IsEmpty を使用しています。
arraylist全体が空かどうかをチェックするためのIsEmptyコマンドjuzですか?
arraylist 全体をチェックする場合、インデックス 7 が空かどうかをチェックするために他にどのような方法を使用できますか?
for (int x = 0; x < (Integer) roomInfo.get(2); x++) {//start of number of room loop(to check how many rooms user input)
for (int i = 0; i < (Integer) roomInfo.get(4 + xx); i++) { //start of number of add-on loop(to check how many add-on user input)
System.out.println("addOns array contains what? : " + addOns); // for my own reference
System.out.println("Enter Add-On option");
ao2 = input.nextInt();
while (ao2 > 4) {
System.out.println("Please enter again! Choose only option 1 to 4");
ao2 = input.nextInt();
}
addOnOpt = addOn[ao2 - 1];
addOns.add(addOnOpt);
addOnPrice = priceAdd[ao2 - 1];
addOns.add(addOnPrice);
System.out.println("Enter quantity required for Add-On option " + (i + 1) + ": ");
quan = input.nextInt();
addOns.add(quan);
xx += 3;
System.out.println(" not null yet");
if ((roomInfo.isEmpty(4 + xx) == true) {//if condition to check whether is the arrayllist of position is not null
System.out.println("null!");
xx = 0;
Selection();
}
}// end of add-on loop
}//end of number of room loop