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

Use result of Collection.toArray(T[])

上级 606eebb5
......@@ -445,9 +445,7 @@ public class ConnectionInfo implements Cloneable {
* @return the property keys
*/
String[] getKeys() {
String[] keys = new String[prop.size()];
prop.keySet().toArray(keys);
return keys;
return prop.keySet().toArray(new String[prop.size()]);
}
/**
......
......@@ -1234,8 +1234,7 @@ public class Database implements DataHandler {
}
private synchronized void closeAllSessionsException(Session except) {
Session[] all = new Session[userSessions.size()];
userSessions.toArray(all);
Session[] all = userSessions.toArray(new Session[userSessions.size()]);
for (Session s : all) {
if (s != except) {
try {
......
......@@ -352,9 +352,7 @@ public class Session extends SessionWithState {
if (variables == null) {
return new String[0];
}
String[] list = new String[variables.size()];
variables.keySet().toArray(list);
return list;
return variables.keySet().toArray(new String[variables.size()]);
}
/**
......@@ -835,8 +833,7 @@ public class Session extends SessionWithState {
}
}
if (savepoints != null) {
String[] names = new String[savepoints.size()];
savepoints.keySet().toArray(names);
String[] names = savepoints.keySet().toArray(new String[savepoints.size()]);
for (String name : names) {
Savepoint sp = savepoints.get(name);
int savepointIndex = sp.logIndex;
......
......@@ -155,8 +155,7 @@ public class IndexCondition {
v = column.convert(v);
valueSet.add(v);
}
Value[] array = new Value[valueSet.size()];
valueSet.toArray(array);
Value[] array = valueSet.toArray(new Value[valueSet.size()]);
final CompareMode mode = session.getDatabase().getCompareMode();
Arrays.sort(array, new Comparator<Value>() {
@Override
......
......@@ -81,8 +81,7 @@ public class SpellChecker {
// System.out.println(unused);
if (printDictionary) {
System.out.println("USED WORDS");
String[] list = new String[used.size()];
used.toArray(list);
String[] list = used.toArray(new String[used.size()]);
Arrays.sort(list);
StringBuilder buff = new StringBuilder();
for (String s : list) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论