What is the difference between '&' and ',' in Java generics?
<T extends MyClass & Serializable>
This asserts that the single type parameter T
must extend MyClass
and must be Serializable
.
<T extends MyClass , Serializable>
This declares two type parameters, one called T
(which must extend MyClass
) and one called Serializable
(which hides java.io.Serializable
— this is probably what the warning was about).