code: @Override
      public String serialize(Map<String, String> map) {
  
          try {
  
              // the format is based on the properties output format
              Properties props = new Properties();
              props.putAll(map);
              Writer writer = new StringWriter();
              props.store(writer, null);
  
              // we need a list of strings so we can further process the format
              List<String> lines = new ArrayList<String>();
              for (String line : writer.toString().split("\r?\n")) {
                  // comments and empty lines are skipped
                  if (!line.trim().isEmpty() && !line.trim().startsWith("#")) {
                      lines.add(line.trim());
                  }
              }
  
              // sort by key so create a canonical format
              Collections.sort(lines);
  
              // build the output string
              StringBuilder builder = new StringBuilder();
              for (String line : lines) {
  
                  if (multiline) {
                      if (builder.length() > 0) {
                          builder.append(lineSeparator);
                      }
                      builder.append(line);
                  }
                  else {
                      if (builder.length() > 0) {
                          builder.append("&");
                      }
                      builder.append(line.replace("&", "\\u0026"));
                  }
  
              }
              return builder.toString();
  
          } catch (IOException e) {
              throw new IllegalStateException(e);
          }
  
      }
docs: /*
  (non-Javadoc)
  
  @see org.togglz.core.util.MapSerializer#convertToString(java.util.Map)