code: protected static int extractMatchingFieldsUnioned(Tuple<? extends SemanticType.Field> lhsFields,
  			Tuple<? extends SemanticType.Field> rhsFields, SemanticType.Field[] result) {
  		int index = 0;
  		// Extract all matching fields first.
  		for (int i = 0; i != lhsFields.size(); ++i) {
  			for (int j = 0; j != rhsFields.size(); ++j) {
  				SemanticType.Field lhsField = lhsFields.get(i);
  				SemanticType.Field rhsField = rhsFields.get(j);
  				Identifier lhsFieldName = lhsField.getName();
  				Identifier rhsFieldName = rhsField.getName();
  				if (lhsFieldName.equals(rhsFieldName)) {
  					SemanticType type = unionHelper(lhsField.getType(), rhsField.getType());
  					SemanticType.Field combined = new SemanticType.Field(lhsFieldName, type);
  					result[index++] = combined;
  				}
  			}
  		}
  		return index;
  	}
docs: ===============================================================