type erasure in implementation of ArrayList in Java
问题 I was reading this article on Java Generics and there it is mentioned that the constructor for an ArrayList looks somewhat like this: class ArrayList<V> { private V[] backingArray; public ArrayList() { backingArray = (V[]) new Object[DEFAULT_SIZE]; } } I was not able to understand how type erasure and type checking by the compiler happens as explained there. One point I got was that the type parameter is transformed to Object type. I would imagine it as (replacing all V with Object ), but