1

According to Collections definition, methods like max and min have the following signature:

static <T extends Object & Comparable<? super T>> T max(Collection<? extends T> coll)

I was wondering why that extends Object would be necessary, as only T is supposed to mean "any type" anyway. As an example, for the sort method definition, from the same documentation, we have only <T extends Comparable<? super T>> as expected.

Is there any reason for that extends Object in max and min specifications?

Community
  • 1
  • 1
Nelio Alves
  • 1,231
  • 13
  • 34
  • 3
    In spite of the title of that question, it truly is a duplicate. The answer (https://stackoverflow.com/a/8055497/5174436) even uses the same example as the OP. – Matthew McPeak Jun 10 '18 at 01:55

0 Answers0