private void writeToTableAndCsv(TabularResultData metricsTable,String type,String metricName,String metricValue,StringBuilder csvBuilder){
  metricsTable.accumulate(CliStrings.SHOW_METRICS__TYPE__HEADER,type);
  metricsTable.accumulate(CliStrings.SHOW_METRICS__METRIC__HEADER,metricName);
  metricsTable.accumulate(CliStrings.SHOW_METRICS__VALUE__HEADER,metricValue);
  if (csvBuilder != null) {
    csvBuilder.append(type);
    csvBuilder.append(',');
    csvBuilder.append(metricName);
    csvBuilder.append(',');
    csvBuilder.append(metricValue);
    csvBuilder.append('\n');
  }
}

private void writeToTableAndCsv ( TabularResultData metricsTable , String type , String metricName , String metricValue , StringBuilder csvBuilder ) { metricsTable . accumulate ( CliStrings . SHOW_METRICS__TYPE__HEADER , type ) ; metricsTable . accumulate ( CliStrings . SHOW_METRICS__METRIC__HEADER , metricName ) ; metricsTable . accumulate ( CliStrings . SHOW_METRICS__VALUE__HEADER , metricValue ) ; if ( csvBuilder != null ) { csvBuilder . append ( type ) ; csvBuilder . append ( ',' ) ; csvBuilder . append ( metricName ) ; csvBuilder . append ( ',' ) ; csvBuilder . append ( metricValue ) ; csvBuilder . append ( '\n' ) ; } }
writes to a tabularresultdata and also appends a csv string to a string builder
