public static VoltXMLElement mergeTwoElementsUsingOperator ( String opName , String opElementId , VoltXMLElement first , VoltXMLElement second ) { if ( first == null || second == null ) { return first == null ? second : first ; } if ( opName == null || opElementId == null ) { return null ; } VoltXMLElement retval = new VoltXMLElement ( "operation" ) ; retval . attributes . put ( "id" , opElementId ) ; retval . attributes . put ( "optype" , opName ) ; retval . children . add ( first ) ; retval . children . add ( second ) ; return retval ; }
If one of the elements is null return the other one diectly .