You need to sign in to do that
Don't have an account?
bujji
How to compare two lists
Hi,
I have two list of ids, i need to compare two list of ids and put unique id in a Third List. How to do it.
suppose
List<ID> ids1 = new List<ID>('003aaa','003bbb','003ccc');
List<ID> ids2 = new List<ID>('003aaa','003bbb');
List<ID> ids3 = new List<ID>();
I want unique value in the third list :
ids3 = '003ccc';
I have written the code like the below, but it is not working.
for(Id id1:contactList){
if(id1.contains(campaignInsertIdlist))
{ }
else
{
insertIds.add(id1);
}
}
I am getting an error saying incorrect signature or contains method is not existed.
Give me suggestion, how to achieve it.
Thanks,
Bujji
I have two list of ids, i need to compare two list of ids and put unique id in a Third List. How to do it.
suppose
List<ID> ids1 = new List<ID>('003aaa','003bbb','003ccc');
List<ID> ids2 = new List<ID>('003aaa','003bbb');
List<ID> ids3 = new List<ID>();
I want unique value in the third list :
ids3 = '003ccc';
I have written the code like the below, but it is not working.
for(Id id1:contactList){
if(id1.contains(campaignInsertIdlist))
{ }
else
{
insertIds.add(id1);
}
}
I am getting an error saying incorrect signature or contains method is not existed.
Give me suggestion, how to achieve it.
Thanks,
Bujji
Check this link for comparing two lists:-
http://salesforce.stackexchange.com/questions/9910/comparing-values-between-two-lists
Thanks
Anil.B