I created following Wrapperclass to sort quote based on ceratedDate
global class QuoteCreateDateSortWrapper implements Comparable {
public Quote quo;
//Constructor
public QuoteCreateDateSortWrapper(Quote qu) {
quo = qu;
}
//Compare the quotes based on CreatedDate
global Integer compareTo(Object compareTo) {
//Cast argument to QuoteCreateDateSortWrapper
QuoteCreateDateSortWrapper compareToQuo = (QuoteCreateDateSortWrapper) compareTO;
//The return value of 0 indicates that both elements are equal.
Integer returnValue = 0;
if(Quo.CreatedDate > compareToQuo.Quo.CreatedDate){
//Set the return value to positive value.
returnValue = 1;
}else if (Quo.CreatedDate < compareToQuo.Quo.CreatedDate) {
//Set the return value to a negative value.
returnValue = -1;
}
return returnValue;
}
}
I created following quoteList to for different validation.
List<Quote> quoteList = new List<Quote>([SELECT Id,IsSyncing,CreatedDate FROM Quote WHERE OpportunityId = :opp.Id]);
now I am trying to copy the above quoteList to wrapperclass list, but I am getting error.
List<QuoteCreateDateSortWrapper> quoListW = new List<QuoteCreateDateSortWrapper>();
quoListW.addALL(quoteList);
Could you please help me to understand what I am doing wrong?