0

I have huge a list of object & I want to sort it's by date, considering my list is :

List a = [
          {
           'id':1,
           'name':"abc",
           'date': 1467849600000
           }
          {
           'id':2,
           'name':"xyz",
           'date': 1459468800000
           }
          {
           'id':3,
           'name':"klm",
           'date': 1460246400000
          }];

This List contains 3 Object having random dates in Long Format

  1. date of 1st object is 7th July 2016
  2. date of 2nd object is 1st April 2016
  3. date of 3rd object is 10th April 2016

I want to sort list such that it should give me output like this :

List a = [
          {
           'id':2,
           'name':"xyz",
           'date': 1459468800000
           }
          {
           'id':3,
           'name':"klm",
           'date': 1460246400000
          }
          {
           'id':1,
           'name':"abc",
           'date': 1467849600000
           }
          ];

All the solutions are welcomed, Thanks in Advance.

Kunal Gadhia
  • 350
  • 2
  • 14
  • @JB Nizet The question you gave on link compares only 2 objects i guess,but I have a list of 100 objects,then how should i sort such a huge list?? – Kunal Gadhia Jul 07 '16 at 17:57
  • By re-reading the answer to the question I linked to again. It uses Collections.sort() three times, and list.sort() two times. So it contains 5 examples showing how to sort a list. Or by just googling and reading the hundreds of pages explaining how to sort. – JB Nizet Jul 08 '16 at 06:24

0 Answers0