を作っているTreeMap<String, String>
ので、降順で注文したいと思います。次のコンパレータを作成しました。
Comparator<String> descender = new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
return o2.compareTo(o1);
}
};
TreeMapは次のように作成します。
myMap = new TreeMap<String, String>(descender);
ただし、次のエラーが発生します。
The method compare(String, String) of type new Comparator<String>(){} must override a superclass method
ジェネリック医薬品を完全に開発したことはありませんが、何が間違っているのでしょうか。