Source:
public Iteration processElement(ParserContext handlerManager, Element element) throws ConfigurationException { String overVar = $(element).attr("over"); IterationBuilderOver iterationOver = StringUtils.isEmpty(overVar) ? Iteration.over() : Iteration.over(overVar); List<Element> children = $(element).children().get(); List<Operation> operations = new ArrayList<>(children.size()); List<Operation> otherwise = new ArrayList<>(); for (Element child : children) { if ("otherwise".equals(child.getNodeName())) { List<Element> otherwiseElements = $(child).children().get(); for (Element otherwiseElement : otherwiseElements) { Object object = handlerManager.processElement(otherwiseElement); if (object instanceof Operation) { otherwise.add((Operation) object); } } } else if ("otherwise".equals(child.getNodeName())) { List<Element> performElements = $(child).children().get(); for (Element performElement : performElements) { Object object = handlerManager.processElement(performElement); if (object instanceof Operation) { operations.add((Operation) object); } } } else { Object object = handlerManager.processElement(child); if (object instanceof Condition) { iterationOver.when((Condition) object); } else if (object instanceof Operation) { operations.add((Operation) object); } } } IterationBuilderPerform iterationBuilderPerform = iterationOver.perform(operations.toArray(new Operation[operations.size()])); IterationBuilderOtherwise iterationBuilderOtherwise = iterationBuilderPerform.otherwise(Perform.all(otherwise.toArray(new Operation[otherwise .size()]))); return (Iteration) iterationBuilderOtherwise; }

Target:
public Iteration processElement(ParserContext handlerManager, Element element) throws ConfigurationException { String overVar = $(element).attr("over"); IterationBuilderOver iterationOver = StringUtils.isEmpty(overVar) ? Iteration.over() : Iteration.over(overVar); List<Element> children = $(element).children().get(); List<Operation> operations = new ArrayList<>(children.size()); List<Operation> otherwise = new ArrayList<>(); for (Element child : children) { if ("when".equals(child.getNodeName())) { List<Element> whenElements = $(child).children().get(); for (Element whenElement : whenElements) { Object object = handlerManager.processElement(whenElement); if (object instanceof Condition) { iterationOver.when((Condition) object); } } } else if ("perform".equals(child.getNodeName())) { List<Element> performElements = $(child).children().get(); for (Element performElement : performElements) { Object object = handlerManager.processElement(performElement); if (object instanceof Operation) { operations.add((Operation) object); } } } else if ("otherwise".equals(child.getNodeName())) { List<Element> otherwiseElements = $(child).children().get(); for (Element otherwiseElement : otherwiseElements) { Object object = handlerManager.processElement(otherwiseElement); if (object instanceof Operation) { otherwise.add((Operation) object); } } } else { Object object = handlerManager.processElement(child); if (object instanceof Operation) { operations.add((Operation) object); } } } IterationBuilderPerform iterationBuilderPerform = iterationOver.perform(operations .toArray(new Operation[operations.size()])); if (otherwise.size() > 0) { IterationBuilderOtherwise iterationBuilderOtherwise = iterationBuilderPerform.otherwise(Perform .all(otherwise.toArray(new Operation[otherwise.size()]))); return (Iteration) iterationBuilderOtherwise; } return (Iteration) iterationBuilderPerform; }