I can not understand the method implementation and the logic of Collections.sort method. Here is the method implementation i found,
public static
First of all this method return type is void. What is > does in the method signature?
is a generic Type that you use in your method, T could only be an object which implements java.util.Comparable.
for example if you want to pass a List
to the sort method it'd compile as java.lang.String
implements java.lang.Comparable
, but if you pass List
you'd get a compiler error unless Animal
implements java.lang.comparable