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

Rearrange Account ID Return Statements

How do I my code so that I can pull 1 return statement or the other.  See below:
    public static List<String> getDnBMatches(String companyName){
    	List<String> dnbFinalMatchList = new List<String>();  
        List<String> dnbCompleteMatches = new List<String>(); 
        List<String> dnbPartialMatches = new List<String>();
    	List<String> nameFragments = new List<String>();
        Map<id,DatacloudDandBcompany> dnbData = new Map<id,DatacloudDandBcompany>();
        if (String.isBlank(companyName)){
            	return null;
            	for (String fragment : companyName.split(' ')){
                     nameFragments.add('%' + fragment + '%');
                dnbData.putall([SELECT companyId FROM DatacloudDandBCompany WHERE Name LIKE :nameFragments]);
                for (DatacloudDandBCompany c: dnbData.values()){
                    if (companyName =={
         return dnbCompleteMatches;
         return dnbPartialMatches;
This part is the challenge:
return dnbCompleteMatches; return dnbPartialMatches;