Java “Type parameter X is not within its bound; should implement Comparable” (LocalDateTime as key in map)

后端 未结 1 2031
自闭症患者
自闭症患者 2021-01-20 11:38

I have implemented my own Map called AVLTreeMap. Here is the class signature.

public class AVLTreeMap, V>
相关标签:
1条回答
  • 2021-01-20 11:49

    Your generic signature for a Comparable is a little off, this

    public class AVLTreeMap<K extends Comparable<K>, V>
    

    Should be something like

    public class AVLTreeMap<K extends Comparable<? super K>, V>
    
    0 讨论(0)
提交回复
热议问题