You need to sign in to do that
Don't have an account?

Remove duplicate values from a List
Hi
I Need to remove duplicate values from a list .I used the following code but still the values in the list are not removed and I get the original list itself.
--here Catalogue is my Object
Set<SITEdu__Catalog__c> CaAg = New Set<SITEdu__Catalog__c>();
List<SITEdu__Catalog__c> CaAgListresult = new List<SITEdu__Catalog__c>();
List<SITEdu__Catalog__c> CaAgList = new List<SITEdu__Catalog__c>();
public List<SITEdu__Catalog__c> getStudentAgView()
{
CaAgList = [select SITEdu__CatalogType__c from SITEdu__Catalog__c];
CaAg.addAll(CaAgList);
CaAgListresult.addAll(CaAg);
return CaAgListresult;
}
Could someone please guide me in getting this done.
Thanks in Advance,
Regards,
Christwin
With the way you are currently doing it, each record is different for the Catalog even though they have the same Catalog Type.
why not use of set or map?
Oh...So will set remove the duplicates with the same name from the object. Cant that be used to remove duplicates from a list.?
Kindly guide me.
Yeah I have tried using set for that..I have mentioned how I have used it in the message.Kindly let me know if that is not the right way of doing .I still get the duplicates in the list by doing so.
Thank you so much,
Regards,
Christwin