The title pretty much explains the question. I have an interface method:
Set<Field> getFieldSet()
and I have a class, User
which looks something like this
class User {
enum Fields implements Field {
USERNAME, PASSWORD;
...
}
...
}
Now I want to implement User
's getFieldSet()
method. The naive way seems to just return EnumSet.allOf(Fields.class)
but I get the following error:
> Type mismatch: cannot convert from Set<User.Fields> to Set<Field>
Other than manually copying the EnumSet to Set<Field>
, is there a good way to do this?