public static Map<String, String> maptoMapString(Map<String, ?> map) {
return map.entrySet().stream().collect(Collectors.toMap(
(entry) -> {
return entry.getKey();
},
(entry) -> {
if(entry.getValue().getClass().isArray()) {
StringBuilder sb = new StringBuilder();
for(int i=0; i<Array.getLength(entry.getValue()); ++i) {
Object obj = Array.get(entry.getValue(), i);
sb.append(obj.toString()).append(",");
}
if (sb.length() > 0) {
sb.deleteCharAt(sb.length() - 1);
} return sb.toString();
} else {
return entry.getValue().toString();
}
}
));
}