Getting filtered autolist Is there a better way to write the following code fragment?

I can't have more than 10 conditional statement in my method as it gives cyclomatic complexity. 

private List&lt;AutoDto&gt; getFilteredAutoList() 
{
    List&lt;AutoDto&gt; autoList = getAutoListForCoverage();
    List&lt;AutoDto&gt; filteredAutoList = new ArrayList&lt;AutoDto&gt;();

    for(AutoDto auto : autoList)
    {
        if("FAQ025".equals((auto.getCarCode()))
                ||"FAQ025".equals((auto.getCarCode()))
                ||"QEF025".equals((auto.getCarCode()))
                ||"QEF037AB".equals((auto.getCarCode()))
                ||"FAQ037AB".equals((auto.getCarCode()))
                ||"FAQ045".equals((auto.getCarCode()))
                ||"QEF045".equals((auto.getCarCode()))
                ||"NBEF028".equals((auto.getCarCode()))
                ||"OPCF028".equals((auto.getCarCode()))
                //20 more OR conditions
                )
        {
            filteredAutoList.add(auto);
        }
    }
    return filteredAutoList;
}


The following two approaches came to my mind:


Using HashSet 

private List&lt;AutoDto&gt; getFilteredAutoList() 
{
    List&lt;AutoDto&gt; autoList = getAutoListForCoverage();
    List&lt;AutoDto&gt; filteredAutoList = new ArrayList&lt;AutoDto&gt;();

    Set&lt;String&gt; carCodeSet = getCarCodeSet();

    for(AutoDto auto : autoList)
    {
        if(carCodeSet.contains(auto.getCarCode()))
        {
            filteredAutoList.add(auto);
        }
    }
    return filteredAutoList;
}


private Set&lt;String&gt; getCarCodeSet()
{
    Set&lt;String&gt; carCodeSet = new HashSet&lt;String&gt;();

    carCodeSet.add("FAQ025");
    carCodeSet.add("QEF025");
    carCodeSet.add("QEF037AB");
    carCodeSet.add("FAQ037AB");
    carCodeSet.add("FAQ045");
    carCodeSet.add("QEF045");
    carCodeSet.add("NBEF028");
    carCodeSet.add("OPCF028");
    //20 more codes to be added

    return carCodeSet;
}

Using String contains method

private List&lt;AutoDto&gt; getFilteredAutoList1() 
{
    List&lt;AutoDto&gt; autoList = getAutoListForCoverage();
    List&lt;AutoDto&gt; filteredAutoList = new ArrayList&lt;AutoDto&gt;();

    String carCodeString = "FAQ025,QEF025,QEF037AB,FAQ037AB,FAQ045,QEF045,NBEF028,OPCF028";
    for(AutoDto auto : autoList)
    {
        if(carCodeString.contains(auto.getCarCode()))
        {
            filteredAutoList.add(auto);
        }
    }
    return filteredAutoList;
}



Which approach should I follow and why?
Why don't you simply use an array of strings, as in:

String carCodeSet[] = {"FAQ025","QEF025","QEF037AB", /*...*/ };


this seems to me cleaner. Of course the HashSet would have better performance if the list of codes is very long... but maybe for 20 items a linear search on the array is not bad.

The String.contains method poses some problems in the fact that you cannot have the separator (comma) in your strings and, more importantly, that any sub-string would match: for example the code "FAQ" would be found as a sub-string. These might not be an issue in your actual use case, but is something which I would prefer not to have in my code.