I have an object array as below.
[obj1 obj2 obj3 ...]
Each object in the array is having properties date (java.util.Date) and name (String).
obj1.date = new Date(); obj1.name = "A";
The objects in the array have already been sorted based on the date. More than one object can have same date values.
Now, I want to sort the array of objects based on name of object if objects are having same date. To be more clear, there should not be any change in the order of objects if dates of all objects are different. If objects are having same date, sort only those objects based on name. Note that the current array is already sorted based on date.
For an example I have the below array [obj1,obj2,obj3,obj4]
obj1.name = "B"; obj1.date = Tue Jul 01 00:00:00 IST 2014;
obj2.name = "D"; obj2.date = Thu Jul 03 00:00:00 IST 2014;
obj3.name = "A"; obj3.date = Thu Jul 03 00:00:00 IST 2014;
obj4.name = "C"; obj4.date = Sun Jul 06 00:00:00 IST 2014;
After sorting array should be [obj1,obj3,obj2,obj4]