+ 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 == c.name){
         return dnbCompleteMatches;
         return dnbPartialMatches;
This part is the challenge:
return dnbCompleteMatches; return dnbPartialMatches;