R
RC
Since I upgrade Java from 1.4.2 to 1.5.002, each time
I got those generics warning messages.
Please help me get rid those messages.
public class MyClass {
private Vector vector;
public MyClass(Vector vector) { this.vector = vector; }
public Vector getVector() { return vector; }
public void addVector(Object object) { vector.addElement(object); }
}
.....
MyClass dude = new MyClass(new Vector<String>());
dude.addVector("The Hell");
// Here I got warning from MyClass addVector method
warning: [unchecked] unchecked call to addElement(E) as a member of the
raw type java.util.Vector
vector.addElement(object);
Vector<String> vv = dude.getVector();
// Here I also get warning message
warning: [unchecked] unchecked cast
found : java.util.Vector
required: java.util.Vector<String>
Vector<String> vv = (Vector<String>)dude.getVector();
Can someone out there help me get rid those warning messages?
Thank Q very much in advance!!
I got those generics warning messages.
Please help me get rid those messages.
public class MyClass {
private Vector vector;
public MyClass(Vector vector) { this.vector = vector; }
public Vector getVector() { return vector; }
public void addVector(Object object) { vector.addElement(object); }
}
.....
MyClass dude = new MyClass(new Vector<String>());
dude.addVector("The Hell");
// Here I got warning from MyClass addVector method
warning: [unchecked] unchecked call to addElement(E) as a member of the
raw type java.util.Vector
vector.addElement(object);
Vector<String> vv = dude.getVector();
// Here I also get warning message
warning: [unchecked] unchecked cast
found : java.util.Vector
required: java.util.Vector<String>
Vector<String> vv = (Vector<String>)dude.getVector();
Can someone out there help me get rid those warning messages?
Thank Q very much in advance!!