Here you can find the source of encodeMap(Map
public static String[] encodeMap(Map<String, String> map)
//package com.java2s; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; public class Main { public static String[] encodeMap(Map<String, String> map) { String[] array = new String[map.size()]; AtomicInteger integer = new AtomicInteger(0); map.forEach((key, value) -> array[integer.getAndIncrement()] = key + "-" + value); return array; } }//from w w w.ja v a 2 s .co m