Compares the specified collection with this list for equality.
Compares the specified collection with this list for equality.Returns true if and only if the specified collection is a collection, both collections have the same size, and all corresponding pairs of elements in the two collections are equal. (Two elements e1 and e2 are equal if (e1==null ? e2==null : compare( e1, e2 )==0.)
In other words, two collections are defined to be equal as lists if they contain the same elements in the same order.
This implementation first checks if the specified collection is this list. If so, it returns true; if not, it checks if the specified collection is a list or a tree set. If not, it returns false; if so, it iterates over both collections, comparing corresponding pairs of elements by using the compare function of this list. If any comparison returns false, this method returns false. If either iterator runs out of elements before the other it returns false (as the lists are of unequal length); otherwise it returns true when the iterations complete.
This method has a time complexity of O(Min(N,M)), with N being the size of the list and M being the number of elements in the object compared.