public int compareTo(Object another) throws CustomMadeException
{
if(this.getClass() != another.getClass() )
{
throw new CustomMadeException();
}
Car other = (Car) another;
return this.getBrand().compareTo(other.getBrand());
}
コードの何が問題なのか正確にはわかりません。なぜTを同等に実装できないのですか?compareToの引数をTに変更する必要がありますか?しかし、それはオブジェクトであるべきではありませんか?私の知る限り、comparableインターフェースでのcompareToの実装は空白です。