java - sort List<CrExcessMaster> by opendate property in bean class -
my method is
public filtereduiexcesslist getcustomerexcesses(long cif,string primaryco) throws exception { if (cif != null && !cif.equals(0l)) { list<crexcessmaster> crexcessmasterlist = getexcessdbservice() .getexcessesforcustomer(cif); }
excessuibean class has opendate property
public class excessuibean implements comparable<excessuibean>{ private boolean notifydaholder; private string davalueforuser; private string excessid; private string excessda; private string status; private string product; private string measure; private string currency; private string limitatexcess; private string excessamount; private string excessdate; private string maxriskamount; private string maxriskdate; private string comments; private string predefinedcomments; private string opendate; public string getopendate() { return opendate; } public void setopendate(string opendate) { this.opendate = opendate; } //getters , setters
i need sort crexcessmasterlist
per opendate
property
you need implement comparable
in class crexcessmaster
.and override compareto()
public int compareto(crexcessmaster obj) { return opendate.compareto(obj.getopendate) }
and use collections.sort(listname);
Comments
Post a Comment