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

for each loop
hi i want two compare two values in a loop for ex my code is
here in my uniqueData there are 5 Strings . when ever i enter in to loop iam spliting the String and assigning it to two variables. now my question is if two strings in agm ae same i dont want to print it for ex{if i get teja in first iterator. and also teja in second iterator . i dont want that name }. how can i compare first agm and second agm
for(String sr : uniqueData){ list<String> dr = sr.split('~',2); agm = dr[0]; dvr = dr[1]; }
here in my uniqueData there are 5 Strings . when ever i enter in to loop iam spliting the String and assigning it to two variables. now my question is if two strings in agm ae same i dont want to print it for ex{if i get teja in first iterator. and also teja in second iterator . i dont want that name }. how can i compare first agm and second agm
Please try below code.
Let us know if it helps you.
All Answers
Please try below code.
Let us know if it helps you.
If you are using uniqueData as Set<String> it won't accept duplicate records.So no need to compare it.If you are using List<String> you need to compare.
Thanks,
Dhriti