<T extends Object & E> vs <T extends E>
The signature of java.util.Collections.max is as follows:
public static <T extends Object and Comparable <? super T → T max (collection collection);
From what I understand, this basically means that T should be both java.lang.Object and java.lang.Comparable <? super T "> ,
However, since each java.lang.Comparable is also java.lang.Object , what is the difference between the signature above and below?
public static <T extends Comparable <? super T → T max (collection collection);
+28
Pacerier Apr 26 '12 at 18:33 2012-04-26 18:33
source share1 answer
To preserve binary compatibility : it is fully described here . The second signature actually changes the return type of the method to Comparable and loses the Comparable return of Object . The original signature saves both.
+28
nobeh Apr 26 '12 at 18:42 2012-04-26 18:42
source share