-1

I have a list of objects that I have retrieved from a webservice call. On the other end, the list of objects looks like this:

({ead=3/11/2016, qty=8}, {ead=4/22/2016, qty=46}, {ead=10/26/2016, qty=34})

However, once the list gets pulled into Salesforce, it comes in this format:

({ead=10/26/2016, qty=34}, {ead=3/11/2016, qty=8}, {ead=4/22/2016, qty=46}).

I need to keep the first format. How do I do this?

ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97
Nick D
  • 251
  • 1
  • 7
  • 20

1 Answers1

2

Since that is a list of objects then you can sort it by the date using collections.sort...

Example:

public static void main(String[] args) {
    List<CustomSalesObject> myList = new ArrayList<CustomSalesObject>();
    Collections.sort(myList, new Comparator<CustomSalesObject>() {
        @Override
        public int compare(CustomSalesObject o1, CustomSalesObject o2) {
            // TODO Auto-generated method stub
            return o1.getDate().compareTo(o2.getDate());
        }
    });
}
Community
  • 1
  • 1
ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97