【发布时间】:2017-04-13 13:32:00
【问题描述】:
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 块,我如何让它遍历整个数组并转到 else 块仅当没有任何元素满足 if 条件时。请帮忙
【问题讨论】: