I believe I am making a really simple mistake/ overlooking something trivial.
import java.util.Comparator;
public class NaturalComparator {
You accidentally created a generic type parameter Integer
which has nothing to do with the Integer
class, and you didn't implement Comparator
. Try
public class NaturalComparator implements Comparator
Placing an identifier in <>
on the class declaration declares a generic type parameter, but placing an identifier in <>
on the implements/extends clause is a passing a type argument.