다음과 같이 코드 스 니펫이 있습니다. 조건 검사의 else 부분에서 값을 무시하거나 제거하고 싶습니다. offerRecords.remove (tariffOffer) 나던Groovy 목록에서 특정 값 제거
offerRecords.each { tariffOffer ->
handsetData.each { hs ->
if (tariffOffer.HANDSET_BAND.stringValue() == hs.HANDSET_BAND?.stringValue()) {
//println 'condition is satisfied and set the handset id ****** '
handset.add(hs.HANDSET_PKEY_ID?.stringValue())
}
if (handset.size() > 0) {
// need to call a method
recHandset = applyHandsetRulesCHL(tariffOffer, handset)
}
else {
// ignore/remove the tariffOffer
offerRecords.remove(tariffOffer) // i know it doesn't serve the purpose
}
'handset'은 무엇입니까 :
한 예는 반복이 완료되면 원래의 목록에서를 누른 다음, 잘못된 항목의 병렬 목록을 계속 제거하는 것? 우리가 실행할 수있는 몇 가지 코드를 생각해 내시겠습니까? 나는 당신이'findAll'을 원한다고 의심한다. –
def 핸드셋 = [], 핸드셋은 목록이다. 내 코드 조각이 내 전체 프로그램의 아주 작은 부분이기 때문에, 독립적으로 실행할 수있는 샘플을주는 것이 어렵다. – Techie