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

Duplicate id in set to list conversion
Hi,
In order remove duplicate records, I converted List to Set and converted same set to list. But, converted list still is giving duplicate records. Please assist.
Regards,
Animesh
In order remove duplicate records, I converted List to Set and converted same set to list. But, converted list still is giving duplicate records. Please assist.
List<Property__c> propertyList = new List<Property__c>(); Set<Property__c> propertySet = new Set<Property__c>(); //propertySet //unique for(Property__c prop : propertySet){ propertyList.add(prop); } system.debug('>>>>>propertySet'+propertySet);//unique system.debug('propertyList++++++'+propertyList) //duplicate records Database.update(propertyList,false);//duplicate id in list
Regards,
Animesh
try this
01 for(Property__c prop : propertyList){
02 propertySet.add(prop);
03 }
propertyList.addAll(propertySet)