I am trying to remove duplicate and creating a set and list with non duplicate values related to field ord__c . Trying to minimize the code as far as possible. Let me know if I can handle the same using the below piece of code I am using :
Set < Id > OrId = new Set < Id > ();
Integer j = 0;
while (j < ListR.size())
{
OrId.add(ListR.get(j).Ord__c);
if(OrId.contains(ListR.get(j).Ord__c))
{
ListR.remove(j);
}
else
{
j++;
}
}