Java difference to execute app in Command Prompt and Eclipse

I have a java console application whose application are show difference to run in Eclipse and at Command Prompt.

I already detected a difference in my business logic and is this:

In Eclipse:

    List<ErpInvoice.Concepto.ConceptosHGH> lsTempConcepto = new ArrayList<ErpInvoice.Concepto.ConceptosHGH>(tConcepto.getConcepto().size()); 
    lsTempConcepto.addAll(tConcepto.getConcepto());

    System.out.println(lsTempConcepto.get(0).isPrimary()); //FALSE
    Collections.sort(lsTempConcepto);
    System.out.println(lsTempConcepto.get(0).isPrimary()); //TRUE

In Command Prompt:

    List<ErpInvoice.Concepto.ConceptosHGH> lsTempConcepto = new ArrayList<ErpInvoice.Concepto.ConceptosHGH>(tConcepto.getConcepto().size()); 
    lsTempConcepto.addAll(tConcepto.getConcepto());

    System.out.println(lsTempConcepto.get(0).isPrimary()); //FALSE
    Collections.sort(lsTempConcepto);
    System.out.println(lsTempConcepto.get(0).isPrimary()); //FALSE

The idea is I have a list with two elements and this list has come in the next order:

First Element (0) his attribute isPrimary = False

and

Second Element(1) his attribute isPrimary = True

And after to execute Collections.sort(list) the order should have been the next one

First Element (0) his attribute isPrimary = True

and

Second Element(1) his attribute isPrimary = False

and why are difference?

Answer

this is just comment rather than answer as I don’t have enough reputation now :) .

U may need to paste the code of “ErpInvoice.Concepto.ConceptosHGH”. This class is supposed to implement the interface of “java.lang.Comparable”. Just check the method named CompareTo(T o).

Leave a Reply

Your email address will not be published. Required fields are marked *