标签: JAVA
Java中List.toArray()的使用方法
错误用法:
Long[] l = (Long[])list.toArray();
以上会出现ClassCastException异常。
正确用法:
第一种方法:
Long[] l = new Long[];
list.toArray(l);
第二种方法:
Long[] l = (Long[]) list.toArray(new Long[0]);
第三种方法:
Long[] a = new Long[];
Long[] l = (Long[]) list.toArray(a);
Compare of AS3
Compare with AS2:
http://livedocs.adobe.com/flex/2/langref/migration.html
Compare with JAVA5.0:
http://flexblog.faratasystems.com/?p=115