Combining bounded wildcards in Java
Is there anyway to use a bounded wildcard require a class implement more than one interface?
In otherwords, something like...
class Foo<S extends Comparable && Clonable>
...which would require that objects extend both interfaces?
I realize I can make another ComparableAndClonable which extends the two but I don't have control over some of the code (So I can't go make my future-S开发者_C百科 object implement ComparableAndClonable).
class Foo<S extends Comparable & Clonable>
Should work.
See Java Generics Wildcarding With Multiple Classes for further info.
[1]:
精彩评论