Comparable interface

1. Definition:

public interface Comparable{
   public int compareTo(Object o);

}

e1.equals((Object)e2) and e1.compareTo((Object)e2)==0 have the same value

If the data or elements in the List implement this interface, we can call Collections.sort or the Arrays method to sort them.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325383715&siteId=291194637