Java Map to String toString(Map attributes)

Here you can find the source of toString(Map attributes)

Description

to String

License

Apache License

Parameter

Parameter Description
attributes a parameter

Return

String

Declaration

public static String toString(Map<?, ?> attributes) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Map;

public class Main {
    /**/*from   w ww . java  2  s  . c o m*/
     * @param attributes
     * @return String
     */
    public static String toString(Map<?, ?> attributes) {
        StringBuilder buffer = new StringBuilder();

        if (attributes != null && attributes.size() > 0) {
            for (Map.Entry<?, ?> entrySet : attributes.entrySet()) {
                buffer.append(entrySet.getKey());
                buffer.append("=\"");
                buffer.append(entrySet.getValue().toString());
                buffer.append("\"");
                buffer.append(" ");
            }

            if (buffer.length() > 0) {
                buffer.deleteCharAt(buffer.length() - 1);
            }
        }
        return buffer.toString();
    }
}

Related

  1. mapToStringMap(final Object map)
  2. toQueryString(Map ps)
  3. toStr(Map msg)
  4. toString(final Map tokens)
  5. toString(Map varnames_to_Terms)
  6. toString(Map map)
  7. toString(Map map)
  8. toString(Map map)
  9. toString(Map m)