public static <K, V> String mkString(Map<K, V> map, String begin, String end,
                                         String keyValueSeparator, String elementSeparator) {
        StringBuilder bld = new StringBuilder();
        bld.append(begin);
        String prefix = "";
        for (Map.Entry<K, V> entry : map.entrySet()) {
            bld.append(prefix).append(entry.getKey()).
                    append(keyValueSeparator).append(entry.getValue());
            prefix = elementSeparator;
        }
        bld.append(end);
        return bld.toString();
    }
@Test
    public void mkStringTest() {
        Map<String, String> map = new LinkedHashMap<>();
        map.put("key1", "val1");
        map.put("key2", "val2");
        map.put("key3", "val3");
        String result = Utils.mkString(map, "__begin__", "__end__", "=", ",");
        assertEquals("__begin__key1=val1,key2=val2,key3=val3__end__", result);

        String result2 = Utils.mkString(Collections.emptyMap(), "__begin__", "__end__", "=", ",");
        assertEquals("__begin____end__", result2);
    }