I have no idea how to fix the compile warning.

Y:\Development\Java\Mileage\Mileage\src\my\Mileage\MileageUI.java:296: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.Vector

dataList.add(doctorData);

Appreciate some suggestions. Thanks..

Can you please post your code so we can see the problem in context. Thanks.

*Sorry BestJewSinceJC I didnt realize you already asked the same question until after I posted ;) *

Edited 7 Years Ago by Grn Xtrm: n/a

Here's the code snip

Vector dataList = new Vector();
try {
            while (resultSet.next()) {

                // Save the data for loading the comboBox
                doctorData = new DoctorData();                      // Create an data object
                doctorData.setName(resultSet.getString("name"));    // Save the name in position 1
                doctorData.setTitle(resultSet.getString("title"));  // Save the title
                doctorData.setDoctorID(resultSet.getLong("doctorid"));  // Save the primary key

//This is line that is giving the compile warning message
                dataList.add(doctorData);
            }
        } catch (SQLException e) {
            e.printStackTrace();
}

Edited 7 Years Ago by bruceaj: n/a

Isn't Vector a generic class? You would have to define the generic type when you create the new vector.
Judging by your code you would want something like:

Vector<DoctorData> dataList = new Vector<DoctorData();

Does that fix the problem? ...I'm pretty sure vector is generic...

That fixed the problem. Now I have NO idea what "generic classes" are. So I need to do some googling.

Thanks....

Isn't Vector a generic class? You would have to define the generic type when you create the new vector.
Judging by your code you would want something like:

Vector<DoctorData> dataList = new Vector<DoctorData();

Does that fix the problem? ...I'm pretty sure vector is generic...

Yeah, it is. That's the error I expected to see, but you never can be too sure without seeing the code.

@OP, you might want to take a look at this.

http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html

Generic classes can be pretty tricky, but if you are only using them and not actually implementing them you don't need to understand all the messy details. Basically they are classes that can operate on different types of data, so you need to define what type of data you want them to work on.

This question has already been answered. Start a new discussion instead.