@@ -0,0 +1,988 @@
+package ch5_generics;%0A%0A/**%0A * Created by k557782 on 9/4/14.%0A */%0Apublic class item_25_prefer_lists_to_arrays %7B%0A    // 1)Arrays are covariant%0A    // Fails at runtime!%0A    //Object%5B%5D objectArray = new Long%5B1%5D;%0A    //objectArray%5B0%5D = %22I don't fit in%22; // Throws ArrayStoreException%0A//%0A//    List%3CObject%3E ol = new ArrayList%3CLong%3E();%0A//    ol.add(%22I don't fit in%22)%0A//%0A    // with an array you find out that you%E2%80%99ve made a mistake at runtime; with a list, you find out at compile time.%0A    // 2) Arrays are reified, arrays know and enforce their element types at runtime.%0A    // For example, it is illegal to create an array of a generic type, a parameterized type, or a type parameter.%0A    // Can't create generic arrays, it isn't typesafe%0A    //Types such as E, List%3CE%3E, and List%3CString%3E are technically known as non-reifiable types .%0A    // Intuitively speaking, a non-reifiable type is one whose runtime representation contains less information than%0A    // its compile-time representation.%0A%7D%0A

Add item 25