与えられた:
public interface PrimaryKey<Key extends Comparable> {
Key getKey();
}
と
public class PrimaryKeyComparator implements Comparator<PrimaryKey> {
public int compare(PrimaryKey first, PrimaryKey second) {
return first.getKey().compareTo(second.getKey());
}
}
この組み合わせは機能しますが、生の型に関する警告が表示されます。型引数を追加するさまざまな方法を試しましたが、試したすべての組み合わせでコードが壊れます。