public Object[] toArray()Returns an array containing all of the elements in this list in proper sequence (from first to last element). The returned array will be "safe" in that no references to it are maintained by this list. (In other words, this method must allocate a new array). ...
Javapublic <TsuperE> T[] toArray(T[] a); 不過, <T super E> 這樣的語法在 Java 中是不存在的。而且即使存在,對數(shù)組也不起作用。也正是因為這個原因,在使用這個方法時,即使 T 是 E 的父類,或 T 跟 E 相同,也不能完全避免 java.lang.ArrayStoreException 異常5, 6, 7 。請看下面兩段代碼。第...