code: protected static String buildCommaSeparatedString( List<String> lines )
      {
          if ( lines == null || lines.size() == 0 )
          {
              return null;
          }
  
          List<String> strings = new ArrayList<String>( lines.size() );
          for ( String str : lines )
          { // filter out blank strings
              if ( StringUtils.isNotBlank( str ) )
              {
                  strings.add( StringUtils.trimToEmpty( str ) );
              }
          }
  
          return StringUtils.join( strings, "," );
      }
docs: Helper method to build a comma separated string from a list.
  Blank strings are filtered out
  
  @param lines A list of strings
  @return Comma separated String from given list