2016-10-05 12 views
1

Comparableインターフェイスの助けを借りてパスリストをソートしようとしていますが、恐ろしく失敗します。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' 

は、私は答えは明白です怖いが、私はちょうどそれを見ることはありません!これは、問題を詳細に説明するエラーです

+2

問題はまさにそれが言うことです。 'JSONBase'は既に' Comparable 'を実装しています。異なる型の引数でそれを再実装することはできません。 – shmosel

+0

うわー。ありがとう。私は...愚かな気分だ... – Dendrowen

答えて

1
'java.lang.Comparable' cannot be inherited with different type arguments: 
'com.dendrowen.oveasy.model.JSONBase' and 'com.dendrowen.oveasy.model.Pass 

(もちろん私はcompareTo()方法を必要と知っています)。それは言う:

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

関連する問題