我试图在Comparable界面的帮助下对我的传球列表进行排序,但是我的失败非常糟糕。
public class Pass extends JSONBase implements Comparable<Pass>{
}
此行引发了Android Studio中的下一个错误:
'java.lang.Comparable' cannot be inherited with different type arguments:
'com.dendrowen.oveasy.model.JSONBase' and 'com.dendrowen.oveasy.model.Pass'
我担心答案很明显,但我只是看不到它! (我当然知道我需要compareTo()
方法)
答案 0 :(得分:2)
'java.lang.Comparable' cannot be inherited with different type arguments:
'com.dendrowen.oveasy.model.JSONBase' and 'com.dendrowen.oveasy.model.Pass
这是一个错误,它详细描述了问题。它说:
The Interface 'java.lang.Comparable' cannot be inherited with different type arguments
You're trying to inherite it with type JSONBase and Pass.
这意味着JSONBase已经实现了它,并且不可能再次实现它。您可以在@Override
Pass.java
使用适当的方法