Cost of compound if/or versus try/catch in Java 6

后端 未结 7 1529
旧时难觅i
旧时难觅i 2020-12-31 20:12

We currently have the following compound if statement...

if ((billingRemoteService == null)
    || billingRemoteService.getServiceHeader() == null
    || !\"         


        
7条回答
  •  孤城傲影
    2020-12-31 20:50

    You could mix Groovy into your JVM-based application - the line will get considerably simpler then:

    def result = billingRemoteService?.
      serviceBody?.
      serviceResponse?.
      customersList?.
      customersList[0];
    if ('00' != billingRemoteService?.serviceHeader?.statusCode ||
       result?.
       billAccountInfo?.
       getEcpdId == null)
      throw new WebServicesException
    ...
    

提交回复
热议问题