TermCommentPost For Break Statement

4 Comments

  • What if it was not labelled. Would it break from the inner loop or from all the loops ?

    for(int var1=0; var1 < 5 ; var1++)
    {
    for(int var2 = 1; var2 < 5; var2++)
    {
    System.out.println(“var1:” + var1 + “, var2:” + var2);

    if(var1 == 3)
    break ;

    }
    }

  • if (action.getActionStatus() == ActionStatus.Completed) {

    boolean bFind = false;

    String strKey=””;

    theScenario.getLogger().debug(“[ActionCallback:raiseAlarmValidationCallback] – “+id+” – Alarm ID – ActionStatus.Completed ******!!!!!!!!!!” );

    for (Iterator<actionresponseitem> it = action

    .getListActionResponseItem().iterator(); it.hasNext();) {

    ActionResponseItem tempResponse = it.next();

    List<com.hp.uca.mediation.action.jaxws.actionresponseitem.output.entry> listEntry = tempResponse

    .getOutput().getEntry();

    for (Iterator<com.hp.uca.mediation.action.jaxws.actionresponseitem.output.entry> itEntry = listEntry

    .iterator(); itEntry.hasNext();) {

    com.hp.uca.mediation.action.jaxws.ActionResponseItem.Output.Entry entry = itEntry

    .next();

    theScenario.getLogger().debug(“[ActionCallback:raiseAlarmValidationCallback] – “+id+” – Key=” + entry.getKey() + “, value=”

    + entry.getValue());

    strKey = entry.getKey();

    if (strKey.equalsIgnoreCase(“EntitySpec”)) {

    strRet = entry.getValue();

    theScenario.getLogger().debug(“[ActionCallback:raiseAlarmValidationCallback] – “+id+” – Alarm ID – ” + strRet);

    bFind = true;

    break;

    }

    }

    if (bFind)

    break;

    }

    if(strKey != null) {

    Flag flag=new Flag(strRet.toLowerCase(), “CIMD_SIA_PROCESS:” , true);

    theScenario.getSession().insert(flag);

    }

    } else{

    theScenario.getLogger().debug(“[ActionCallback:raiseAlarmValidationCallback] : Failure – “+id+” – Alarm ID – ” + action.getActionStatus().toString()+ ” : “+

    action.getActionStatusExplanation().toString()+” : “+ action.getActionSubStatus().toString());

    }

    how to break 1st if loop

Sponsors

Facebook Fans