Reputation: 377
I have an interface like this:
public interface Data<T> {
List<T> getData();
}
Implementation of the interface:
public class HealthData implements Data {
public List<HealthDataEntry> getData() {
// Do something
}
}
When I invoke the method I get an unchecked assignment warning:
Data data = new HealthData();
List<HealthDataEntry> healthData = data.getData() //Unchecked assignment warning thrown here
It works but the warning is annoying, can you please advice me on how to fix this?
Upvotes: 0
Views: 47
Reputation: 140318
public class HealthData implements Data<HealthDataEntry>
And
Data<HealthDataEntry> data = new HealthData();
Otherwise you are using a raw type.
Upvotes: 5