【发布时间】:2013-05-24 08:33:30
【问题描述】:
我的代码 sn-p 如下所示,我想在条件检查的 else 部分的列表中忽略/删除该值。 offerRecords.remove(tariffOffer) 似乎不起作用
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 hander = [],handler 是一个列表,因为我的代码 sn-p 是我整个程序的一小部分,我很难给出一个可以独立运行的示例