I have two different methods which fetch data from tow different DB tables. I will add both data into same ArrayList
using bean
class.
List<LeadVO> leadvoList = new ArrayList<LeadVO>(); // array list declaration
In the while loop
I will load all the data using bean
class. Before this action I will fire query for both tables.
while(true){
LeadVO statusVO = new LeadVO(); //initializing bean class
// code to load all value using setters
Finally I will add this bean to array list
:
leadvoList.add(statusVO);
created seperate class to compare
public class ComparatorDAO implements Comparator {
public int compare(LeadVO arg0, LeadVO arg1) {
return arg1.getCreatedtimeFormat().compareTo(arg0.getCreatedtimeFormat()) ;
}
}
Collections.sort(commentVOList,new ComparatorDAO()); //sorting method
ideally this will not sort according to date i believe this will treat date as string
please help me in this
thanks once again
Now I need to sort this list in date order which is already present in the list. I mean the date which is present in the list.