Java Generic with ArrayList
ArrayList<? extends A> means an ArrayList of some unknown type that extends A. That type might not be C, so you can’t add a C to the ArrayList. In fact, since you don’t know what the ArrayList is supposed to contain, you can’t add anything to the ArrayList. If you want an ArrayList that can … Read more