提交 a335281e authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

ArrayList in not needed in DataUtils.appendMap(StringBuilder, HashMap)

上级 c790224e
...@@ -12,9 +12,7 @@ import java.nio.ByteBuffer; ...@@ -12,9 +12,7 @@ import java.nio.ByteBuffer;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -570,10 +568,10 @@ public final class DataUtils { ...@@ -570,10 +568,10 @@ public final class DataUtils {
*/ */
public static StringBuilder appendMap(StringBuilder buff, public static StringBuilder appendMap(StringBuilder buff,
HashMap<String, ?> map) { HashMap<String, ?> map) {
ArrayList<String> list = new ArrayList<>(map.keySet()); Object[] keys = map.keySet().toArray();
Collections.sort(list); Arrays.sort(keys);
for (String k : list) { for (Object k : keys) {
appendMap(buff, k, map.get(k)); appendMap(buff, (String) k, map.get(k));
} }
return buff; return buff;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论