I'm in Java 7
and I have the following enum:
public enum BooleanEnum implements StringRepresentable{
YES {
@Override
public String getStringRepresentation() {
return "true";
}
},
NO {
@Override
public String getStringRepresentation() {
return "false";
}
};
public abstract String getStringRepresentation();
}
Now I have the method:
List<StringRepresentable> getValues(){
return Arrays.asList(BooleanEnum.values()); //Type mismatch:
//cannot convert from List<BooleanEnum> to List<StringRepresentable>
}
What's wrong with that enum
? It implements the interface, therefore the code should have compiled fine.