hi team , i retreive a list and now i have to fetch and copy the Id from the reterive list to the new empty list . Please note that there are duplicate ID present in the retreive list so duplicate ids should not copied to the new list . please help how i can achieve it . Please give proper steps it will be really helpful Thanks
To remove duplicates, You can use a loop.
Pass your retreived list into the loop.
Check with the list operation(contains or find or find by expression) by passing your new empty list and iterator object.
If the list operation returns an object then continue the loop else add it to your empty list.