62,623
社区成员
发帖
与我相关
我的任务
分享
public Object enlargeArray(Object obj)throws Exception{
if(!obj.getClass().isArray()){
throw new Exception("该对象不是数组类型!");
}
int length = Array.getLength(obj);
return Array.newInstance(obj.getClass(), length+10);
}
List list = 。。。// 你的List
MyObject[] objs = new MyObject[list.size()];
for(int i=0;i<list.size();i++){
objs[i] = list.get(i);
}