循环遍历列表时,我想根据条件删除列表中的项目.请参阅下面的代码.
这给了我一个ConcurrentModification
例外.
for (Object a : list) {
if (a.getXXX().equalsIgnoreCase("AAA")) {
logger.info("this is AAA........should be removed from the list ");
list.remove(a);
}
}
Run Code Online (Sandbox Code Playgroud)
如何才能做到这一点?
我尝试使用cxf(版本2.2.3,2.2.6和2.7.0)通过给出以下命令从wsdl生成存根和客户端
> wsdl2java.bat -p com.easynet.eordering.client -client http://expediter.staging.gis.easynet.com:7001/cds/services/eordering?wsdl
Run Code Online (Sandbox Code Playgroud)
但我得到一个错误
WSDLToJava错误:非独特的身体部位!在端口中,操作必须在线路上具有唯一的操作信号,以便成功发送.在端口{http://eordering.uk.easynet.net} eorderingPortSOAP,Operations"{http://eordering.uk.easynet.net} getAMList"和"{http://eordering.uk.easynet.net} getDCList "拥有相同的请求正文块{http://eordering.uk.easynet.net} userListRequest
我知道为什么抛出这个错误,在我的wsdl操作中被写为
<operation name="getDCList"><input message="tns:userListRequest"/><output message="tns:userListResponse"/></operation>
<operation name="getAMList"><input message="tns:userListRequest"/><output message="tns:userListResponse"/></operation>
Run Code Online (Sandbox Code Playgroud)
我只是为这两个操作重用了userListRequest参数,我相信错误是因为在两个操作中都指定了相同的参数(userListRequest).
有没有办法在不更改wsdl的情况下避免此错误?(据我所知,wsdl 1.2不允许操作重载,但输入参数重载?).
我在后期处理中使用我的逻辑来处理设备和文件的值,如下所示:(将其更改为从映射设置,因为它覆盖了值)
def deviceFiles = devices.inject([] as Set) { deviceFiles, device ->
def v = device.key.split( /\./ )[0]
deviceFiles << [ (device.value), files[ v ] ]
}
Run Code Online (Sandbox Code Playgroud)
输出:deviceFiles:[[Acer C6,Tetris.apk],[Motorola Droid Milestone,Tetris.apk],[Acer C6,TheSims3.apk],[HTC Desire,TheSims3.apk]] ---看起来不错
这些值将作为map/properties传递,以便正确显示数据而不会出现任何强制转换异常,我发现这很难.
当它通过集合循环时
deviceFiles.each { device ->
mapping.put("${device}", "${file}")
}
Run Code Online (Sandbox Code Playgroud)
输出:映射:[HTC Desire:TheSims3.apk,Motorola Droid Milestone:Tetris.apk,Acer C6:Tetris.apk] - 这是不正确的(Acer C6:TheSims3.apk已被覆盖)
在将预期值发送到地图中时,我是否遗漏了一些内容?或者不可能通过map发送set的值(因为当我迭代设备时,map总是消除重复)???
我有3个查询,根据条件检索最大值.
select max(to_number(substr(attr_value,9)))+1
from circ_inst inner
join circ_attr_settings
on circ_inst.circ_inst_id=circ_attr_settings.circ_inst_id
and val_attr_inst_id=1045
where circ_attr_settings.attr_value like 'IPANEMA-%'
select max(to_number(substr(attr_value,10)))+1
from circ_inst inner
join circ_attr_settings
on circ_inst.circ_inst_id=circ_attr_settings.circ_inst_id
and val_attr_inst_id=1045
where circ_attr_settings.attr_value like 'FIREWALL-%'
select max(to_number(substr(attr_value,16)))+1
from circ_inst
inner join circ_attr_settings
on circ_inst.circ_inst_id=circ_attr_settings.circ_inst_id
and val_attr_inst_id=1045
where circ_attr_settings.attr_value like 'LAYER2 SWITCH-%'
Run Code Online (Sandbox Code Playgroud)
我想从这3个查询中获得最大数量(如果3个查询的结果分别是6430,6434和6418,那么我想获得值"6434",这是三个结果中的最大值.
我尝试过max(query1,query2,query3)
但没有成功.
我的代码如下:
for (Map.Entry<Integer, ABC> x : getOfferCriteria().getCommitments()
.entrySet()) {
ABC abc = x.getValue();
if (abc.getYYY() == 0) {
abc.setEnabled(false);
}
}
Run Code Online (Sandbox Code Playgroud)
如何在不使用for循环的情况下仅检索第一个值并禁用它,因为我知道第一个值始终为零