public ArrayList(Collection<? extends E> c) {
elementData = c.toArray();
size = elementData.length;
// c.toArray might (incorrectly) not return Object[] (see 6260652)
if (elementData.getClass() != Object[].class)
elementData = Arrays.copyOf(elementData, size, Object[].class);
}
c.toArray might not return Object[] 不明白toArray为何会不返回object[],有没有其他例子说明下呢? stackoverflow有这个问题,不过回答貌似也没有启发的感觉,是我智商捉急了么- -||http://stackoverflow.com/questions/8521147/why-need-to-convert-type-to-object-array-in-arraylists-construction
人到中年有点甜
随时随地看视频慕课网APP
相关分类