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

How do i remove Duplicates below is my code. AuraEnabled methods do not support return type of Set<String> so i could not add the list to set and return the set value. Can someone help
@auraEnabled
Public static List<string> invokeWebServiceString ssnumber) {
String [] arrayOfResponsestrings = new List<String>();
for(String num : ssnumber.split(',')){
ResponseWrapper APIResponse = InvokeAPI.invokeRespAPI(num);
arrayOfResponsestrings.add(JSON.serialize(APIResponse ));
System.debug('arrayOfResponsestrings :'+arrayOfResponsestrings);
}
for(Integer i=0 ;i<arrayOfResponsestrings.size() ; i++) {
}
return arrayOfResponsestrings;
}
Public static List<string> invokeWebServiceString ssnumber) {
String [] arrayOfResponsestrings = new List<String>();
for(String num : ssnumber.split(',')){
ResponseWrapper APIResponse = InvokeAPI.invokeRespAPI(num);
arrayOfResponsestrings.add(JSON.serialize(APIResponse ));
System.debug('arrayOfResponsestrings :'+arrayOfResponsestrings);
}
for(Integer i=0 ;i<arrayOfResponsestrings.size() ; i++) {
}
return arrayOfResponsestrings;
}
Why not you can do like this way:
Please let me know if you have any question.
Thanks
Gulshan Raj
All Answers
Thanks for you reply. But i have to keep this statement String [] arrayOfResponsestrings = new List<String>(); as my response is coming in JSON format for some reason i have to get it in array format. without commenting that statement how do i remove duplicates. Please help
Why not you can do like this way:
Please let me know if you have any question.
Thanks
Gulshan Raj
Thanks a lot that works like a charm.