提交 cad2f4bf authored 作者: Thomas Mueller's avatar Thomas Mueller

Simplified toArray

上级 23d193dc
......@@ -327,7 +327,7 @@ public class Bnf {
}
list.add(s);
}
return list.toArray(new String[0]);
return list.toArray(new String[list.size()]);
}
/**
......
......@@ -314,8 +314,7 @@ public class SelectUnion extends Query {
Message.throwInternalError("type=" + unionType);
}
buff.append('(').append(StringUtils.unEnclose(right.getPlanSQL())).append(')');
Expression[] exprList = new Expression[expressions.size()];
expressions.toArray(exprList);
Expression[] exprList = expressions.toArray(new Expression[expressions.size()]);
if (sort != null) {
buff.append(" ORDER BY ").append(sort.getSQL(exprList, exprList.length));
}
......
......@@ -224,9 +224,11 @@ public class ObjectArray<T> implements Iterable<T> {
* Convert this list to an array. The target array must be big enough.
*
* @param array the target array
* @return the array
*/
public void toArray(Object[] array) {
public T[] toArray(T[] array) {
ObjectUtils.arrayCopy(data, array, size);
return array;
}
/**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论