iterator java库_关于Iterator的next()方法

这种写法是不正确的,会报java.util.NoSuchElementException的错误。iterator.next()不能连续用,这个为什么

Iterator iterator  = list.iterator();

while(iterator.hasNext()){

if(iterator.next().getCompanycode()==null){

error.append("接口表中Companycode的必录项有空,");

}

else if(iterator.next().getSalechannelcode()==null){

error.append("接口表中Salechannelcode的必录项有空,");

}

if(iterator.next().getBillnumber()==null){

error.append("接口表中Billnumber的必录项有空,");

}

if(iterator.next().getBillbooknumber()==null){

error.append("接口表中Billbooknumber的必录项有空,");

}

if(iterator.next().getSeragentcode()==null){

error.append("接口表中Seragentcode的必录项有空,");

}

if(iterator.next().getPhone()==null){

error.append("接口表中Phone的必录项有空,");

}

if(iterator.next().getSersectioncode()==null){

error.append("接口表中Sersectioncode的必录项有空,");

}

if(iterator.next().getSerteamcode()==null){

error.append("接口表中Serteamcode的必录项有空,");

}

if(iterator.next().getPolicyholdername()==null){

error.append("接口表中Policyholdername的必录项有空,");

}

if(iterator.next().getInsurecode()==null){

error.append("接口表中Insurecode的必录项有空,");

}

if(iterator.next().getCerttypecode()==null){

error.append("接口表中Certtypecode的必录项有空,");

}

if(iterator.next().getChargetypecode()==2&&iterator.next().getBankcode()==null){

error.append("CHARGETYPECODE=2转帐时,BANKCODE不能为空,");

}

if(iterator.next().getChargetypecode()==2&&iterator.next().getAccountname()==null){

error.append("CHARGETYPECODE=2转帐时,Accountname不能为空,");

}

if(iterator.next().getChargetypecode()==2&&iterator.next().getAccounts()==null){

error.append("CHARGETYPECODE=2转帐时,Accounts不能为空,");

}

if(iterator.next().getChargetype()==3&&iterator.next().getPeriodofvalidity()==null){

error.append("ChargeType为信用卡时,PERIODOFVALIDITY, 信用卡缴费不能为空,");

}

if(iterator.next().getChargetype()==3&&iterator.next().getPeriodofvalidity().matches("^\\d{4}$")){

error.append("ChargeType为信用卡时,信用卡有效期至 格式不正确,");

}

if (iterator.next().getChargetype()==3//中信信用卡转帐时,Ensuremodel,计划型号必录

&&iterator.next().getBrushbankcode().equals("017")

&&iterator.next().getEnsuremodel()==null){

error.append("中信信用卡转帐时,Ensuremodel,计划型号不能为空");

}

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值