Warning: Vector is a raw type. References to generic type Vector should be parameterized

When I wrote the code as below in Eclipse:

Vector listings_vec = new Vector(3, 2);

It has a warning:

Vector is a raw type. References to generic type Vector should be parameterized

Simply, I changed it to the code as below:

Vector listings_vec = new Vector(3, 2);

The warning disappeared.

It’s said that it’s about “generics”. Java 1.5 is the first version that introduced “generics”. It helps to make type safety in the code.

Leave a Reply

Your email address will not be published. Required fields are marked *