세트를 반복합니다. CarDetail의 값이 설정되어 있지 않으면 루프가 다음 CarDetail에서 다시 시작되기를 원합니다. 하지만 어떻게 든 내 계속 실용적이지는 않습니다. iterator를 계속 사용하지 않을 수 있습니까?세트를 반복하고 계속하십시오.
final Set<CarDetail> tmpDetail = new HashSet<CarDetail>(details);
for(Iterator<CarDetail> iter = tmpDetail.iterator(); iter.hasNext();){
CarDetail detail = iter.next();
if(detail.getBack() == null){
continue;
}
... do something
}
이것은 For 루프입니다. for 루프와 마찬가지로 continue를 사용할 수 있습니다. –
나에게 잘 보입니다. 정확한 예기치 못한 사실과 그 증명 방법에 대한 정보를 추가하십시오. – poitroae
당신이하려는 것을 다시 말해 줄 수 있습니까? 그리고 향상된 for for 루프를 사용할 것을 제안 할 수 있습니까? 'for (CarDetail detail : iter) {'는 훌륭하게 할 것입니다! 아니면 더 나은'for (CarDetail detail : details) {' – corsiKa