0
for(int i =0; i< jarray.length;i ++){
JsonObject jobj = jarray.getJsonObject(i);
//i am running a database query here to fetch a record based on a value in the json object
//i have my if block here
if(the codition is true){
}else{
throw new CustomException
}
}
我的問題是,因爲如果IF條件不滿足它不是遍歷其餘元素的數組中,並會在第一次迭代直接else塊,我如何使它遍歷整個數組,並只有在沒有任何元素滿足if條件時才轉到else塊。好心幫如果裏面還有循環for循環迭代一個JSON陣列自定義異常中的其他塊
謝謝,它的工作。 –