I've read all answers etc, but non of them solved my problem.
I have basic function to sort list of custom object array by String InvoiceNumber.
List<Invoice> invoiceList = new ArrayList<>();
...
// invoiceList filled here
...
Collections.sort(invoiceList, new Comparator<Invoice>()
{
@Override
public int compare(Invoice o1, Invoice o2)
{
return o1.InvoiceNumber.compareTo(o2.InvoiceNumber);
}
});
Some part of Invoice class.
public class Invoice extends AttributeContainer
implements KvmSerializable,android.os.Parcelable, Comparable
{
public String CustomerId;
public String InvoiceNumber;
However, it never calls compare method.
I'm using android studio with latest libraries. Is there anything that I'm missing?

invoiceListhas at least 2 elements?InvoiceNumberspelled like a type name but used like a member variable. Which is it?Invoiceshouldn't implementComparable, but ratherComparable<Invoice>. And you don't really need to implementComparable<Invoice>(orComparable) if you're providing aComparator; but you can, if you so desire.