You need to sign in to do that
Don't have an account?
global class er
hi,
can you correct this
can you correct this
Public static set<Id>getUniqueIds(list<SObject>sobs) { set<Id>Ids=new set<Id>(); for(SObject sob : sobs) { Ids.add(sob.Id); } return Ids; }Error: Compile Error: unexpected token: 'set' at line 1 column 14
Hi,
Are you directly putting this code in your apex class? If yes, you forgot to mention the class name. Use below code
public class ClassName{
Public static set<Id>getUniqueIds(list<SObject>sobs)
{
set<Id>Ids=new set<Id>();
for(SObject sob : sobs)
{
Ids.add(sob.Id);
}
return Ids;
}
}
Regards
Amrender Ghangas
All Answers
You have some error in your method signature .
Try like below .
Only problem is there is no space between method name and return type .
Let me know if it helps .
Hi,
Are you directly putting this code in your apex class? If yes, you forgot to mention the class name. Use below code
public class ClassName{
Public static set<Id>getUniqueIds(list<SObject>sobs)
{
set<Id>Ids=new set<Id>();
for(SObject sob : sobs)
{
Ids.add(sob.Id);
}
return Ids;
}
}
Regards
Amrender Ghangas
Oops you are correct. Sorry not enough coffee this morning.