function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sammy ShkSammy Shk 

How to sort collection of Strings (Email addresses) in alphabetically in invocable apex and pass it back to Flow?

Newbie in apex, I have a list of collection of strings (Email addrsses) in a flow, i want to sort this list with alphabetically. Since flow supports collection sorts only asc or desc, i have decided to use invocable apex to input this collection and sort it alphabetically and pass the list back to flow? How do i sort Collection of strings in invocable apex
Thanks
global class SortCollectionOfStrings {
    
 @InvocableMethod(label='Sort String Collection')    
    global static void SortCollectionOfStrings(list<string> FinalistofEmailcollection){
       FinalistofEmailcollection.sort();
 }
}