How can I limit 2 generic types in a class definition? How should I "where T : " 2 times? I have 2 interfaces Simplex and Complex, and I want a class like
public class MyClass<T,S> where T: Simplex, where S: Complex
{
...
}
? or am I doing it wrong? Where can I find this documentation? googling for "java keyword where generics" doesnt really help: where is a very common word... I cant find it in the java trail on generics either...
I believe this is the syntax you're looking for:
public class MyClass<T extends Simplex, S extends Complex> { }
See this Java Tutorials page for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With