I have a problem with comparing generic types. In C# i I've always done something like that: class Element<T, V> where T : IComparable<T>
. My question is how can it be written in java?
I suspect you want something like:
class Element<T extends Comparable<T>>
... using the Comparable
interface and a bounded type parameter.
来源:https://stackoverflow.com/questions/15771215/comparing-generic-types-java