Java tutorial
//package com.java2s; import java.util.Map; public class Main { public static String getCreateTableSql(String name, Map<String, String> columns) { String ret = "CREATE TABLE " + name + " ("; int counter = 0; for (String key : columns.keySet()) { counter++; ret += key + " " + columns.get(key); if (counter < columns.size()) { ret += ", "; } } ret += ")"; return ret; } }