API: public synchronized Object[] toArray(Object a[]) { if (a.length < elementCount) a = (Object[])java.lang.reflect.Array.newInstance( a.getClass().getComponentType(), elementCount); System.arraycopy(elementData, 0, a, 0, elementCount); if (a.length > elementCount) a[elementCount] = null; return a; }
@param a the array into which the elements of the Vector are to * be stored, if it is big enough; otherwise, a new array of the * same runtime type is allocated for this purpose.
its meaning is that if your parameter Vector isn't long enough,it doesn't matter,method toArray will create a new Vector to replace the old one,and the new Vector's size is just fit for the need.
at jp.co.nec_lease.imart.model.creditanxiety.data.CreditAnxietyLogDBDAO.fetchWithDetail(CreditAnxietyLogDBDAO.java:452)
-----------------------------
代码如下:
----------------------
CreditAnxietyLog[] oCreditAnxietyLogList = (CreditAnxietyLog[]) vector.toArray(new CreditAnxiety[0]);
---------------------------
什么地方出错
直接这样写试一试!!
public synchronized Object[] toArray(Object a[]) {
if (a.length < elementCount)
a = (Object[])java.lang.reflect.Array.newInstance(
a.getClass().getComponentType(), elementCount); System.arraycopy(elementData, 0, a, 0, elementCount); if (a.length > elementCount)
a[elementCount] = null; return a;
}
* be stored, if it is big enough; otherwise, a new array of the
* same runtime type is allocated for this purpose.