1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
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();
}
}
));
}
|
本文转自 小眼儿 博客园博客,原文链接:http://www.cnblogs.com/hujunzheng/p/7215373.html,如需转载请自行联系原作者