我有下面的代码:哪个迭代arrayList直到结束,即使我不需要它。由于xtend没有break语句,我不知道如何分解它。假如我不能将它转换为while循环,xtend中有没有其他方法类似于java中的break语句?如何打破xtend中的foreach循环?
arrayList.forEach [ listElement | if (statusFlag){
if(monitor.canceled){
statusFlag = Status.CANCEL_STATUS
return
}
else{
//do some stuff with listElement
}
}]
不错,比使用异常更简洁! –