KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
This might sound like an odd question but how can on define a generic which has to extend a class AND to implement an interface? Im currently having a generic function with the following prototype: public static <E extends Enum<E>> List<E> buildEnumList(Class<E> enumClass) This works just as intented. My problem now is that I want to further restrict the passable classes to those which are enums and implement a specific interface Readable (not that in java.lang). Since a generic uses the same keyword extends to indicate that it should implement an interface, I dont see any way to get the following pseudo behaviour: public static <E extends Enum<E> implements Readable> List<E> buildLexicographicalEnumList(Class<E> enumClass)
Tags (comma-separated)
Save Edits
Cancel