Reputation: 4591
I can define a class of generic types with multiple interfaces like this:
public class MyList<E extends foo & bar & fum> extends ArrayList<E>
How can I define a method parameter (or a variable) to be of a Collection
of base types that implement multiple interfaces?
Upvotes: 0
Views: 66
Reputation: 62864
Something like :
public <E extends foo & bar & fum> void test(Collection<E> parameter) {
...
}
Note that the E
type here is method-scoped.
Upvotes: 4