Java tutorial
//package com.java2s; import java.util.HashMap; import java.util.Iterator; public class Main { public static String addAttributes(HashMap<String, String> p_attributes) { StringBuffer l_buf = null; Iterator<String> l_iter = null; String l_name = null; if (p_attributes != null) { l_buf = new StringBuffer(); l_iter = p_attributes.keySet().iterator(); while (l_iter.hasNext()) { l_name = l_iter.next(); l_buf.append(" ").append(l_name).append("=\""); l_buf.append(p_attributes.get(l_name)).append("\""); } return l_buf.toString(); } return ""; } }