java - Sort a List of Objects by Date -


i have list of objects have retrieved webservice call. on other end, list of objects looks this:

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

however, once list gets pulled salesforce, comes in format:

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

i need keep first format. how do this?

since list of objects can sort 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());         }     }); } 

Comments

Popular posts from this blog

php - Passing multiple values in a url using checkbox -

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -