我需要知道该compareTo(...)
方法在内部是如何工作的。根据结果,它会交换值吗?
Condition:
1. If obj1 is less than object2 will return negative.
2. If obj1 is greater than object2 will return positive.
3. If obj1 is equal to object2 will return zero.
该compareTo(...)
方法如何根据条件在内部工作
@Override
public int compareTo(DVDInfo o) {
return title.compareTo(o.title); // for title sort
}