Pergunta

If I do this:

public class IntegerList extends ArrayList < Integer > { }

Am I able to use IntegerList normally without worrying about type erasure, meaning I can use and create arrays of them and instantiate them dynamically, and any compliant compiler or IDE will be able to do both compile- and run-time type checking properly?

Foi útil?

Solução

Yes, IntegerList is a reified type, which is what I think you're trying to say.

And while we are at it, ArrayList is also a reified type, which means you can do the same things with ArrayList that you can do with IntegerList. (But not with ArrayList<Integer>, which is not a reified type.)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top